#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > r;
  for (int i = 1; i <= n; i++) {
    if (i != n) r.push_back({i, i + 1});
    if (i >= 4)
      for (int j = i - 3; j >= 1; j -= 2) r.push_back({j, i});
  }
  cout << r.size() << endl;
  for (auto u : r) cout << u.first << " " << u.second << endl;
}
