#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 2;
const int M = 4e6 + 2;
const int mod = 998244353;
const int inf = 2e9 + 3;
const long long INF = 1e16;
int n;
vector<pair<int, int> > ans;
int main() {
  scanf("%d", &n);
  pair<int, int> mx = {0, 0};
  for (int i = 1; i <= n; ++i) {
    mx = max(mx, {i * (n - i), i});
  }
  for (int i = 1; i <= mx.second; ++i) {
    for (int j = mx.second + 1; j <= n; ++j) ans.push_back({i, j});
  }
  printf("%d\n", (int)ans.size());
  for (auto it : ans) printf("%d %d\n", it.first, it.second);
}
