#include<cstdio>
using namespace std;
int n,m;
int main(){
	scanf("%d",&n);m=n+!(n&1);
	printf("%d\n",(n*(n-1)>>1)-(n>>1));
	for (int i=1;i<=n;i++)
	for (int j=i+1;j<=n;j++)
	if(i+j!=m) printf("%d %d\n",i,j);
	return 0;
}