#include <bits/stdc++.h>
using namespace std;
int n, m;
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i)
		for (int j = i + 1; j <= n; ++j)
			if (i + j != n + 1 - n % 2) ++m;
	printf("%d\n", m);
	for (int i = 1; i <= n; ++i)
		for (int j = i + 1; j <= n; ++j)
			if (i + j != n + 1 - n % 2) {
				printf("%d %d\n", i, j);
			}
}
