<filename>boj/silver/2164.cpp<gh_stars>1-10
#include <iostream>
#include <queue>
using namespace std;

int main() {
	int n;
	cin >> n;
	queue<int> q;
	for(int i=1;i<=n;i++) {
		q.push(i);
	}
	while(q.size()>1) {
		q.pop();
		int temp = q.front();
		q.pop();
		q.push(temp);
	}
	cout << q.front() << '\n';
	return 0;
}
