#include <bits/stdc++.h>
using namespace std;
int n;
bool m[128][128];
bool mres[128][128];
bool pode(int a, int b) {
  for (int i = 0; i < n; i++)
    if (m[a][i] and m[b][i]) return false;
  return true;
}
int main() {
  scanf("%d", &n);
  int res = 0;
  if (n == 1) {
    printf("0\n");
    return 0;
  } else if (n == 2) {
    printf("1\n1 2\n");
    return 0;
  } else if (n == 3) {
    printf("2\n1 2\n2 3\n");
    return 0;
  }
  for (int k = 4; k <= n; k++) {
    int cnt = 0;
    memset(m, false, sizeof(m));
    for (int i = 0; i < k - 1; i++) {
      m[i][i + 1] = m[i + 1][i] = true;
      cnt++;
    }
    if (n != 3) {
      m[k - 1][0] = m[0][k - 1] = true;
      cnt++;
    }
    for (int i = 0; i < n; i++)
      for (int j = i + 1; j < n; j++) {
        if (!m[i][j] and pode(i, j)) {
          m[i][j] = m[j][i] = true;
          cnt++;
        }
      }
    if (cnt > res) {
      memcpy(mres, m, sizeof(m));
      res = cnt;
    }
  }
  printf("%d\n", res);
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++)
      if (mres[i][j]) printf("%d %d\n", i + 1, j + 1);
  return 0;
}
