#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> vt;
  for (int i = 2; i <= 2000; i++) {
    vt.push_back(i);
    for (int j = 2; j < i; j++) {
      if (i % j == 0) {
        vt.pop_back();
        break;
      }
    }
  }
  int n;
  scanf("%d", &n);
  vector<pair<int, int> > ans;
  int p = 0;
  for (int x : vt) {
    if (x >= n) {
      p = x;
      break;
    }
  }
  int cnt[n + 5];
  for (int i = 0; i < n; i++) {
    int u = i;
    int v = (i + 1) % n;
    ans.push_back(make_pair(u + 1, v + 1));
  }
  p -= n;
  int w = n / 2;
  for (int i = 1; i <= p; i++) {
    ans.push_back(make_pair(i, i + w));
  }
  printf("%d\n", (int)ans.size());
  ;
  for (pair<int, int> x : ans) printf("%d %d\n", x.first, x.second);
  return 0;
}
