#include <bits/stdc++.h>
using namespace std;
int n, m, q;
int p[100];
void Init(int n) {
  for (int i = 0; i <= n; i++) p[i] = i;
}
int Find(int a) { return p[a] == a ? a : p[a] = Find(p[a]); }
void link(int a, int b) { p[a] = b; }
void Union(int a, int b) { link(Find(a), Find(b)); }
int g[100 + 20][100 + 20];
int main() {
  while (cin >> n) {
    memset(g, 0, sizeof(g));
    int s = 0;
    for (int i = 1; i <= n - 1; i++) {
      g[i + 1][i] = g[i][i + 1] = 1;
      s++;
    }
    for (int i = 1; i <= n - 3; i++) {
      for (int j = i + 3; j <= n; j += 2) {
        g[i][j] = g[j][i] = 1;
        s++;
      }
    }
    cout << s << endl;
    for (int i = 1; i <= n - 1; i++) {
      for (int j = i + 1; j <= n; j++) {
        if (g[i][j]) {
          cout << i << " " << j << endl;
        }
      }
    }
  }
}
