#include <bits/stdc++.h>
int n;
int maps[111][111];
int order[111];
int main() {
  scanf("%d", &n);
  if (n == 1) {
    printf("0\n");
  } else if (n == 2) {
    printf("1\n");
    printf("1 2\n");
  } else if (n == 3) {
    printf("2\n");
    printf("1 2\n2 3\n");
  } else {
    memset(maps, 0, sizeof(maps));
    memset(order, 0, sizeof(order));
    for (int i = 1; i < 4; i++) {
      maps[i][i + 1] = maps[i + 1][i] = 1;
    }
    maps[1][4] = maps[4][1] = 1;
    for (int i = 1; i <= 4; i++) order[i] = 2;
    int ans = 4;
    for (int i = 5; i <= n; i++) {
      if (i % 2 == 0) {
        int cnt = i / 2;
        for (int j = 1; j < i; j++)
          if (order[j] < cnt) {
            order[j]++;
            maps[j][i] = maps[i][j] = 1;
          }
        order[i] = cnt;
        ans += cnt;
      } else {
        int cnt = i / 2;
        maps[1][i] = maps[i][1] = 1;
        order[1] = order[1] + 1;
        for (int j = 2; j < i; j++)
          if (maps[1][j] == 0) {
            order[j] = order[j] + 1;
            maps[i][j] = maps[j][i] = 1;
          }
        order[i] = cnt;
        ans += cnt;
      }
    }
    int fff = 0;
    for (int i = 1; i < n; i++)
      for (int j = i + 1; j < n; j++)
        for (int k = j + 1; k <= n; k++)
          if (maps[i][j] && maps[j][k] && maps[k][i]) fff = 1;
    if (fff == 1) {
    }
    printf("%d\n", ans);
    for (int i = 1; i < n; i++)
      for (int j = i + 1; j <= n; j++)
        if (maps[i][j]) printf("%d %d\n", i, j);
  }
  return 0;
}
