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