#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
#define SPO(n) fixed << setprecision(n)
#define endl '\n'
#define ifor(i, l, r) for (long long(i) = (l); (i) <= (r); ++(i))
#define rfor(i, r, l) for (long long(i) = (r); (i) >= (l); --(i))
typedef long long ll;
const int IINF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1.0e-9;
const long long MOD = 1e9 + 7;
const long long MAX = 1e5 + 5;
int main() {
// std::ios::sync_with_stdio(false);
// cin.tie(0);
// cout.tie(0);
int a1[200010];
int a2[200010];
int n;
while (cin >> n) {
int acc = 0;
memset(a1, 0, sizeof(a1));
memset(a2, 0, sizeof(a2));
ifor(i, 1, 2 * n) {
a1[i]=i;
}
ifor(i, 1, n) {
swap(a1[i], a2[2 * i]);
}
int jj=1;
ifor(i,n+1,2*n) {
swap(a1[i], a2[jj]);
jj+=2;
}
acc++;
int k = 0; //k=1;//a1->a2
//k=0; a2->a1
while (1) {
ifor(i, 1, n) {
if (k) {
swap(a1[i], a2[2 * i]);
} else {
swap(a2[i], a1[2 * i]);
}
}
int j=1;
ifor(i, n+1, 2*n) {
if (k) {
swap(a1[i], a2[j]);
} else {
swap(a2[i], a1[j]);
}
j+=2;
}
if(k) k=0;
else k=1;
acc++;
if(a1[1]==1) break;
else if(a2[1]==1) break;
}
cout << acc << endl;
}
return 0;
}