#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int e = 0;
  int g[100000][2], mid = n / 2;
  g[0][0] = 1;
  g[0][1] = 2;
  g[1][0] = 2;
  g[1][1] = 3;
  g[2][0] = 3;
  g[2][1] = 4;
  g[3][0] = 4;
  g[3][1] = 1;
  if (n == 2)
    e = 1;
  else if (n == 3 || n == 4)
    e = (n - 2) * 2;
  else if (n > 4) {
    e = floor(n * n / 4);
    int l = 0, cnt;
    for (int i = 0; i < mid; i++) {
      cnt = mid;
      for (int j = mid; j < n; j++) {
        g[l][0] = i + 1;
        g[l][1] = cnt + 1;
        l++;
        cnt++;
      }
    }
  }
  printf("%d\n", e);
  for (int i = 0; i < e; i++) {
    printf("%d %d\n", g[i][0], g[i][1]);
  }
  return 0;
}
