#include<iostream>
#include<vector>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> child;
for(int i = 1; i <= n; ++i) child.push_back(i);
vector<int> ans;
int index = 0;
while(child.size() > 1){
index = (index + 2) % child.size();
ans.push_back(child[index]);
child.erase(child.begin() + index);
}
cout << child[0];
return 0;
}