#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  if (n & 1) {
    cout << (n / 2 + 1) * (n / 2) << endl;
  } else
    cout << (n / 2) * (n / 2) << endl;
  if (n & 1) {
    for (int i = 1; i <= n / 2 + 1; i++) {
      for (int j = n / 2 + 2; j <= n; j++) {
        cout << i << ' ' << j << endl;
      }
    }
  } else {
    for (int i = 1; i <= n / 2; i++) {
      for (int j = n / 2 + 1; j <= n; j++) {
        cout << i << ' ' << j << endl;
      }
    }
  }
  return 0;
}
