#include<iostream>
using namespace std;
int main() {
  int N,i,j;
  cin >> N;
  cout << N*(N-1)/2-N/2 << endl;
  for(i=0;i<N-1;i++) {
    for(j=i+1;j<N;j++) {
      if(i+j != N/2*2-1)cout << i+1 << " " << j+1 << endl;
    }
  }
}
