#include <bits/stdc++.h>
using namespace std;
const int OO = (int)2e9;
const double PI = 2 * acos(0.0);
const double EPS = 1e-9;
int dcmp(double a, double b) { return fabs(a - b) <= EPS ? 0 : a > b ? 1 : 2; }
int DI[] = {-1, 0, 1, 0, 1, -1, -1, 1};
int DJ[] = {0, 1, 0, -1, 1, -1, 1, -1};
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > x;
  for (int i = 0; i < (int)n - 1; i++) {
    x.push_back(make_pair(i, i + 1));
    for (int j = i + 3; j < n; j += 2) x.push_back(make_pair(i, j));
  }
  cout << (int)x.size() << endl;
  for (int i = 0; i < (int)(int)x.size(); i++)
    cout << x[i].first + 1 << " " << x[i].second + 1 << endl;
  return 0;
}
