#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
constexpr ll mod = 1e9 + 7;
int n;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n;
  if (n == 1) {
    cout << 0;
    return 0;
  }
  cout << n / 2 * (n - n / 2) << "\n";
  for (int i = 1; i <= n / 2; i++) {
    for (int j = 1; j <= n / 2; j++) {
      cout << i << ' ' << j + n / 2 << "\n";
    }
  }
  if (n % 2) {
    for (int i = 1; i <= n / 2; i++) {
      cout << i << ' ' << n << "\n";
    }
  }
  return 0;
}
