#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, flag, p;
  cin >> n;
  for (int i = n; i < 2 * n; i++) {
    flag = 1;
    for (int j = 2; j <= sqrt(i); j++) {
      if (i % j == 0) {
        flag = 0;
        break;
      }
    }
    if (flag) {
      p = i;
      break;
    }
  }
  cout << p << endl;
  for (int i = 1; i < n; i++) {
    cout << i << " " << i + 1 << endl;
  }
  cout << n << " " << 1 << endl;
  for (int i = 1; i <= p - n; i++) {
    cout << i << " " << i + n / 2 << endl;
  }
  return 0;
}
