#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n;
  cin >> n;
  vector<long long> mv;
  const long long MAXN = 2000;
  long long mark[MAXN];
  memset(mark, 0, sizeof(mark));
  for (long long i = 2; i < MAXN; i++) {
    if (mark[i]) continue;
    mv.push_back(i);
    for (long long j = i * i; j < MAXN; j += i) mark[j] = 1;
  }
  long long pos = lower_bound(mv.begin(), mv.end(), n) - mv.begin();
  cout << mv[pos] << endl;
  for (long long i = 0; i < n; i++) {
    if (i != n - 1)
      cout << i + 1 << " " << i + 2 << endl;
    else
      cout << n << " " << 1 << endl;
  }
  for (long long i = 0; i < mv[pos] - n; i++) {
    cout << i + 1 << " " << (n / 2) + i + 1 << endl;
  }
  return 0;
}
