#include <bits/stdc++.h>
using namespace std;
vector<pair<long long int, long long int> > v;
long long int fep(long long int x, long long int y, long long int mod) {
  long long int res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x) % mod;
    y = y >> 1;
    x = (x * x) % mod;
  }
  return res % mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, i, j;
  cin >> n;
  for (i = 1; i < n; i++) v.push_back(make_pair(i, i + 1));
  for (i = 1; i <= n; i++)
    for (j = i + 3; j <= n; j += 2) v.push_back(make_pair(i, j));
  cout << v.size() << endl;
  for (i = 0; i < v.size(); i++)
    cout << v[i].first << " " << v[i].second << endl;
  return 0;
}
