#include <bits/stdc++.h>
using namespace std;
using db = long double;
using pll = pair<long long, long long>;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t, i, x, j, y, z, k, n;
  cin >> n;
  long long n1 = n / 2, n2 = n - (n / 2);
  std::vector<pll> v;
  for (i = 1; i < n1 + 1; i += 1) {
    for (j = n1 + 1; j < n + 1; j += 1) {
      v.push_back(make_pair(i, j));
    }
  }
  cout << v.size() << '\n';
  for (auto zx : v) cout << zx.first << " " << zx.second << '\n';
  ;
}
