#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const long long MAX = 2005;
int arr[MAX];
int main() {
  int x;
  scanf("%d", &x);
  int a = x / 2;
  int b = x - x / 2;
  cout << a * b << endl;
  int st;
  if (x % 2 == 0) {
    st = b + 1;
  } else {
    st = b;
  }
  for (int i = 1; i <= a; i++) {
    for (int j = st; j <= x; j++) {
      if (i != j) {
        cout << i << " " << j << endl;
      }
    }
  }
}
