#include<bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    cout << n * (n - 1) / 2  - n / 2 << endl; 
    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            if (i + j != n + ((n + 1) % 2)) cout << i << " " << j << endl;
        }
    }
}