#include <bits/stdc++.h>
using namespace std;

int main(void) {
  int N; cin >> N;
  int n = N/2;
  int m = (n*2)*(n*2)/2-(n*2);
  if (N%2 == 0) cout << m << endl;
  else cout << m + N-1 << endl;

  for (int i = 1; i <= n; i++) {
    for (int k = i+1; k < n*2-i+1; k++) {
      cout << i << ' ' << k << endl;
      cout << n*2-i+1 << ' ' << k << endl;
    }
  }

  if (N%2 == 1) {
    for (int i = 1; i < N; i++) cout << i << ' ' << N << endl;
  }

  return 0;
}
