#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, t, l, r;
  vector<long long int> vv;
  vv.push_back(0);
  for (i = 1; i < 1000; i++) {
    vv.push_back(i * 2 - 1);
  }
  cin >> n;
  t = lower_bound(vv.begin(), vv.end(), n) - vv.begin();
  l = 0;
  r = 1;
  cout << t << endl;
  for (i = 0; i < n; i++) {
    if (l == r)
      r++;
    else
      l++;
    cout << l << " " << r << endl;
  }
}
