#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, t, m, j, s;
  long long k, i, p = 0, h = 0, x = 0, y;
  t = 1;
  for (i = 0; i < t; i++) {
    cin >> n;
    int l[n];
    int r[n];
    if ((n + 1) % 2 == 0)
      m = (n + 1) / 2;
    else
      m = (n + 1) / 2 + 1;
    l[0] = 1;
    r[0] = 1;
    l[n - 1] = m;
    r[n - 1] = m;
    cout << m << endl;
    for (j = 1, k = 2; j < n - 1; j++) {
      if (j < m) {
        l[j] = 1;
        r[j] = j + 1;
      } else {
        l[j] = k;
        k++;
        r[j] = m;
      }
    }
    for (j = 0; j < n; j++) std::cout << l[j] << " " << r[j] << std::endl;
  }
}
