#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > edges;
int main() {
  ios_base::sync_with_stdio(false);
  int i, j, k, n, q, m, t, x, y, b;
  cin >> n;
  for (i = 1; i < n; i++) {
    edges.push_back(make_pair(i, i + 1));
  }
  for (i = 1; i <= n; i++) {
    for (j = i + 3; j <= n; j += 2) {
      edges.push_back(make_pair(i, j));
    }
  }
  cout << edges.size() << endl;
  for (i = 0; i < edges.size(); i++) {
    cout << edges[i].first << " " << edges[i].second << endl;
  }
  return 0;
}
