#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  if (n == 1) {
    cout << 0;
    return 0;
  }
  if (n == 2) {
    cout << "1\n";
    cout << 1 << " " << 2;
    return 0;
  }
  vector<pair<int, int> > res;
  vector<vector<int> > g(n + 1);
  for (int i = 1; i < n; i++) {
    res.push_back(make_pair(i, i + 1));
    g[i].push_back(i + 1);
    g[i + 1].push_back(i);
  }
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j <= n; j++) {
      bool b = true;
      for (int ii = 0; b && ii < g[i].size(); ii++)
        for (int jj = 0; b && jj < g[j].size(); jj++) {
          if (i == g[j][jj] || g[i][ii] == g[j][jj]) b = false;
        }
      if (b) {
        g[i].push_back(j);
        g[j].push_back(i);
        res.push_back(make_pair(i, j));
      }
    }
  cout << res.size() << "\n";
  for (int i = 0; i < res.size(); i++)
    cout << res[i].first << " " << res[i].second << "\n";
  return 0;
}
