#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef pair<int, int>pii;
int main()
{
	int num;
	scanf("%d", &num);
	int ban = num;
	if (num % 2 == 0)ban++;
	vector<pii>v;
	for (int i = 1; i <= num; i++)for (int j = i + 1; j <= num; j++)if (i + j != ban)v.push_back(make_pair(i, j));
	printf("%d\n", v.size());
	for (int i = 0; i < v.size(); i++)printf("%d %d\n", v[i].first, v[i].second);
}