#include <bits/stdc++.h>
using namespace std;
int n, d[109][109], cnt;
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) d[i][i + 1] = d[i + 1][i] = 1;
  for (int j = 3; j <= n; j++) {
    for (int i = 1; i + j <= n; i++) {
      bool flag = true;
      for (int k = 1; k <= n; k++) {
        if (k == i || k == i + j) continue;
        if (d[i][k] == 1 && d[k][i + j] == 1) {
          flag = false;
          break;
        }
      }
      if (flag) d[i][i + j] = d[i + j][i] = 1;
    }
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (d[i][j] == 1) cnt++;
  printf("%d\n", cnt / 2);
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (d[i][j] == 1) printf("%d %d\n", i, j);
}
