#include <bits/stdc++.h>
using namespace std;
int adj1[100][100];
int adj[100][100];
int main() {
  int n;
  scanf("%d", &n);
  if (n <= 3) {
    cout << n - 1 << endl;
    for (int i = 0; i < n - 1; i++) {
      cout << i + 1 << " " << i + 2 << endl;
    }
    return 0;
  }
  int max1 = 0;
  int level = 0;
  for (int i = 1; i < n; i++) {
    if (max1 < (i - 1) * (n - i - 1)) {
      max1 = (i - 1) * (n - i - 1);
      level = i;
    }
  }
  for (int i = 1; i <= level; i++) {
    adj[0][i] = 1;
    adj[i][0] = 1;
  }
  for (int i = level + 1; i < n; i++) {
    adj[1][i] = 1;
    adj[i][1] = 1;
    for (int k = 2; k <= level; k++) {
      adj[i][k] = 1;
      adj[k][i] = 1;
    }
  }
  int sum = 0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) sum = sum + adj[i][j];
  printf("%d\n", sum);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (adj[i][j]) {
        printf("%d %d\n", i + 1, j + 1);
      }
    }
  }
}
