#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  if (n == 1) {
    cout << 0 << endl;
  } else if (n == 2) {
    cout << 1 << endl;
    cout << "1 2" << endl;
  } else {
    cout << (n / 2) * (n / 2 + n % 2) << endl;
    for (int i = 1; i <= n / 2; i++) {
      for (int j = n / 2 + 1; j <= n; j++) {
        cout << i << " " << j << endl;
      }
    }
  }
}
