#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long maxval = 0;
  long long counter = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= n; j++) {
      if (counter <= n) {
        if (abs(i - j) % 2 == 0) {
          if (i + (abs(i - j) / 2) > maxval) maxval = i + (abs(i - j) / 2);
          counter++;
        } else {
          if ((i + (abs(i - j) / 2) + 1) > maxval)
            maxval = i + (abs(i - j) / 2) + 1;
          counter++;
        }
      }
    }
  }
  cout << maxval << endl;
  counter = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= n; j++) {
      if (counter <= n) {
        if (abs(i - j) % 2 == 0) {
          cout << i + (abs(i - j) / 2) << " " << i + (abs(i - j) / 2) << endl;
          counter++;
        } else {
          cout << i + (abs(i - j) / 2) << " " << i + (abs(i - j) / 2) + 1
               << endl;
          counter++;
        }
      }
    }
  }
  return 0;
}
