#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  cout << (n / 2) * (n - (n / 2)) << '\n';
  int pt = n / 2;
  for (int(i) = 0; (i) < ((n / 2) * (n - (n / 2))); i++)
    cout << (i % (n / 2)) + 1 << " " << ((i % (n / 2)) == 0 ? ++pt : pt)
         << '\n';
  return 0;
}
