#include<cstdio>
bool G[105][105];
int main(){
	int n,i,j;
	scanf("%d",&n);
	printf("%d\n",(n*(n-1)>>1)-(n>>1));
	if(n&1)for(i=1;i<n;++i)
		for(j=i+1;j<=n;++j)if(i+j!=n)printf("%d %d\n",i,j);
		else;
	else for(i=1;i<n;++i)
		for(j=i+1;j<=n;++j)if(i+j-1!=n)printf("%d %d\n",i,j);
	return 0;
}