#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int N = 1e2 + 10;
int t, n, m, k, l, r, op, x, y;
bool f[N];
void solve() {
cin >> n;
x = n;
for (int i = 1; x; i = i % n + 1) {
if (f[i])continue;
k++;
if (k==3) {
if(x==1){
cout<<i;
return;
}
f[i] = true;
x--;
k = 0;
}
}
}
//1 2 3 4 5
//. . x . .
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
solve();
return 0;
}