#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf(" %d", &n);
  vector<pair<int, int> > ans;
  for (int i = 2; i <= n; ++i) {
    ans.push_back({i, i - 1});
    int val = i - 3;
    if (val > 0) ans.push_back({val, i});
    val -= 2;
    while (val > 0) {
      ans.push_back({val, i});
      val -= 2;
    }
  }
  cout << ans.size() << endl;
  for (pair<int, int> va : ans) printf("%d %d\n", va.first, va.second);
  return 0;
}
