# include "iostream"
# include "cstdio"
# include "vector"

using namespace std;

vector<pair<int,int> > Map;

int N,BadEdge;

int main(){
	register int i,j;
	scanf("%d",&N);
	BadEdge=N+(!(N&1));
	for(i=1;i<=N;i++){
		for(j=i+1;j<=N;j++){
			if(i+j==BadEdge) continue;
			Map.push_back(make_pair(i,j));
		}
	}
	printf("%d\n",Map.size());
	for(i=0;i<Map.size();i++){
		printf("%d %d\n",Map[i].first,Map[i].second);
	}
	return 0;
}