#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, n;
  while (cin >> n) {
    if (n & 1)
      printf("%d\n", (n / 2) * (n + 1) / 2);
    else
      printf("%d\n", (n * n) / 4);
    for (i = 1; i <= n / 2; i++)
      for (j = n / 2 + 1; j <= n; j++) printf("%d %d\n", i, j);
  }
  return 0;
}
