#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1000000000,1000000000")
using namespace std;
const long long inf = 1e18 + 7;
const long long mod = 1e9 + 7;
const double eps = 1e-9;
const double PI = 2 * acos(0.0);
const double E = 2.71828;
vector<pair<long long, long long> > ans;
int main(void) {
  long long n;
  cin >> n;
  if (n == 1) {
    cout << 0 << endl;
    exit(0);
  }
  if (n == 2) {
    cout << 1 << endl;
    cout << 1 << " " << 2 << endl;
    exit(0);
  }
  if (n == 3) {
    cout << 2 << endl;
    cout << 1 << " " << 2 << endl;
    cout << 2 << " " << 3 << endl;
    exit(0);
  }
  for (long long(i) = 0; (i) < (long long)(n / 2); (i)++)
    for (long long(j) = 0; (j) < (long long)(n - n / 2); (j)++) {
      ans.push_back(make_pair(i, j + n / 2));
    }
  cout << ans.size() << endl;
  for (long long(i) = 0; (i) < (long long)(ans.size()); (i)++)
    cout << ans[i].first + 1 << " " << ans[i].second + 1 << endl;
  return 0;
}
