#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e6 + 5;
const int INF = 0x7fffffff;
bool p(long long a) {
  for (long long i = 2; i <= sqrt(a); i++) {
    if (a % i == 0) return 0;
  }
  return 1;
}
int main() {
  int n;
  cin >> n;
  int c = n;
  while (!p(c)) {
    c++;
  }
  cout << c << '\n';
  for (int i = 1; i < n; i++) cout << i << ' ' << i + 1 << '\n';
  cout << 1 << ' ' << n << '\n';
  for (int i = 1; i <= c - n; i++) cout << i << ' ' << n - i << '\n';
}
