#define forn(i, n) for (int i = 0; i < (int)(n); i++)
int n;
cin >> n;
int prev[n], next[n];
forn(i, n) {
prev[i] = (i + n - 1) % n;
next[i] = (i + 1) % n;
}
void Delete( int i ) {
prev[next[i]] = prev[i];
next[prev[i]] = next[i];
}
void Add( int after, int x ) {
prev[x] = after;
next[x] = next[after]
next[prev[x]] = x;
prev[next[x]] = x;
}