#include <bits/stdc++.h>
using namespace std;
int a[10000 + 10], b[10000 + 10];
int sol;
int main() {
  int n;
  scanf("%d", &n);
  if (n == 1)
    puts("0");
  else if (n == 2)
    printf("1\n1 2\n");
  else if (n == 3)
    printf("2\n1 2\n2 3\n");
  if (n <= 3) {
    return 0;
  }
  int k = n / 2 + 1;
  for (int i = 1; i < k; i++) {
    for (int j = k; j <= n; j++) {
      a[sol] = i;
      b[sol++] = j;
    }
  }
  printf("%d\n", sol);
  for (int i = 0; i < sol; i++) printf("%d %d\n", a[i], b[i]);
  return 0;
}
