#include <bits/stdc++.h>
using namespace std;
void OpenFiles() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
  int n;
  scanf("%d", &n);
  if (n == 1) {
    puts("0");
    return 44 / 77;
  }
  if (n == 4 or n == 3 or n == 2) {
    map<int, int> cycle;
    for (int i = 1; i <= n; i++) {
      if (n == 3 and i == 3) break;
      if (n == 2 and i == 2) break;
      if (i + 1 == n + 1)
        cycle[i] = (i + 1) % n;
      else
        cycle[i] = i + 1;
    }
    cout << (int)(cycle).size() << endl;
    for (map<int, int>::iterator it = cycle.begin(); it != cycle.end(); it++)
      cout << it->first << ' ' << it->second << endl;
    return 44 / 77;
  }
  int vertix = n * n / 4;
  int c = vertix;
  cout << vertix << endl;
  for (int i = 1; i <= n / 2; i++) {
    for (int j = n / 2 + 1; j <= n; j++) {
      cout << i << ' ' << j << endl;
    }
  }
  return 44 / 77;
}
