#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int N;
//---------------------------------------------------------------------------------------------------
void out(vector<pair<int, int>>& E) {
    printf("--------------------\n");
    fore(p, E) printf("%d %d\n", p.first + 1, p.second + 1);
    printf("--------------------\n");
}
bool check(vector<pair<int, int>>& E) {
    vector<vector<int>> e(N);
    fore(p, E) {
        e[p.first].push_back(p.second);
        e[p.second].push_back(p.first);
    }

    set<int> s;
    rep(cu, 0, N) {
        int sm = 0;
        fore(to, e[cu]) sm += to + 1;
        s.insert(sm);
    }

    if (s.size() == 1) {
        printf("[%d]\n", *s.begin());
        return 1;
    }
    return 0;
}
//---------------------------------------------------------------------------------------------------
void naive() {
    vector<pair<int, int>> E;
    rep(a, 0, N) rep(b, a + 1, N) E.push_back({ a,b });
    int n = E.size();
    rep(msk, 0, 1 << n) {
        vector<pair<int, int>> e;
        rep(i, 0, n) if (msk & (1 << i)) e.push_back(E[i]);
        if (check(e)) out(e);
    }
}
//---------------------------------------------------------------------------------------------------
int E[105][105];
int go(int notuse) {
    rep(i, 1, N + 1) rep(j, 1, N + 1) E[i][j] = 1;
    rep(i, 1, N + 1) E[i][i] = 0;

    E[1][notuse] = E[notuse][1] = 0;

    int sm = 0;
    rep(i, 2, N + 1) if (notuse != i) sm += i;

    rep(cu, 2, N + 1) {
        int tot = 0;
        rep(to, 1, N + 1) if (E[cu][to]) tot += to;
        if (tot == sm) continue;

        int ok = 0;
        rep(to, 1, N + 1) if (tot - to == sm and E[cu][to]) {
            E[cu][to] = E[to][cu] = 0;
            ok = 1;
            break;
        }
        if (!ok) return 0;
    }

    return 1;
}
void solve() {
    rep(notuse, 2, N + 1) if (go(notuse)) {
        vector<pair<int, int>> ans;
        rep(i, 1, N + 1) rep(j, i + 1, N + 1) if (E[i][j]) ans.push_back({ i,j });
        int n = ans.size();
        printf("%d\n", n);
        fore(p, ans) printf("%d %d\n", p.first, p.second);
        return;
    }
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;

    /*rep(n, 4, 101) {
        N = n;

        rep(notuse, 1, N + 1) if (go(notuse)) {
            vector<pair<int, int>> ans;
            rep(i, 1, N + 1) rep(j, i + 1, N + 1) if (E[i][j]) ans.push_back({ i-1,j-1 });

            if (!check(ans)) {
                printf("ng! %d\n", n);
                fore(p, ans) printf("%d %d\n", p.first+1, p.second+1);
                return;
            }
            break;
        }
    }*/

    solve();
    //naive();
}

Measured memory_bytes: 384