#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > ans;
int main() {
  int n, side1;
  cin >> n;
  side1 = n / 2;
  if (n % 2) ++side1;
  for (int i = 1; i <= side1; i++)
    for (int j = side1 + 1; j <= n; j++) ans.push_back({i, j});
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i].first << " " << ans[i].second << endl;
}
