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

int main()
{
	int N;
	cin >> N;

	cout << N * (N - 1) / 2 - N / 2 << endl;

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < i; j++) {
			if (i + j + 1 != (N / 2) * 2) {
				cout << j + 1 << " " << i + 1 << endl;
			}
		}
	}
}
