#include <iostream>
#include <string>
#include <queue>
#include <algorithm>
using namespace std;
int n;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
queue<int> Q;
cin >> n;
for(int i=1;i<=n; i++) {
Q.push(i);
}
while(Q.size()>1) {
Q.pop();
int x=Q.front();
Q.pop();
Q.push(x);
}
cout << Q.front();
}
To embed this project on your website, copy the following code and paste it into your website's HTML: