#include<iostream>
#include<queue>
using namespace std;
queue<int>q;
int main(){
int k;
cin >> k;
bool flag = false;
int n = 2 * k;//总人数
for(int i = 1; i <= n; i++)
if(i <= k)
q.push(1);//标记为好人
else q.push(0); //否则就是坏人
while(!flag){
int m = k;
int l = n;
while(l > 1){
for(int i = 1; i <= l; i++){
if(i == m)
q.pop(), l--;
q.push(q.front());
q.pop();
}
}
if(q.front() == 1){
flag = true;
cout << m;
}
else m++;
}
return 0;
}