Cpp code for any no. of people


#1

#include
using namespace std;

int main() {
int n;
cin>>n;
if(n==2||n==1) return 1;
int ans=1;
for(int i=3;i<=n;i++)
{
ans=ans+2;
if(ans==i)
ans=1*(-1);
}
if(ans==-1)
ans==n;
cout<<ans;
return 0;
}