#include <bits/stdc++.h>
using namespace std;
struct vert {
  bool col;
};
int main() {
  vert* mas = new vert[100];
  int n;
  scanf("%d", &n);
  if (n == 1) {
    printf("0\n");
    return 0;
  }
  mas[0].col = true;
  mas[1].col = false;
  int wh = 1;
  int bl = 1;
  vector<pair<int, int> > answ;
  answ.push_back(pair<int, int>(1, 2));
  for (int i = 2; i < n; ++i) {
    if (wh < bl) {
      mas[i].col = true;
      ++wh;
      for (int j = 0; j < i; ++j) {
        if (mas[i].col ^ mas[j].col)
          answ.push_back(pair<int, int>(i + 1, j + 1));
      }
    } else {
      mas[i].col = false;
      ++bl;
      for (int j = 0; j < i; ++j) {
        if (mas[i].col ^ mas[j].col)
          answ.push_back(pair<int, int>(i + 1, j + 1));
      }
    }
  }
  printf("%d\n", (int)answ.size());
  for (int i = 0; i < (int)answ.size(); ++i)
    printf("%d %d\n", answ[i].first, answ[i].second);
  return 0;
}
