#include <bits/stdc++.h>
using namespace std;
bool check(int n,int m)
{
queue<int> q;
for(int i=1;i<=n;i++)
q.push(i);
while(q.size()>n/2)
{
for(int i=1;i<=m-1;i++)
{
int x=q.front();
q.pop();
q.push(x);
}
int x=q.front();
q.pop();
if(x<=n/2)
{
return false;
}
}
return true;
}
int main()
{
int k;
cin>>k;
int n=2*k;
for(int m=k+1;;m++)
{
if(check(n,m))
{
cout<<m;
return 0;
}
}
return 0;
}