#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n;
  cin >> n;
  vector<long long> g[n + 1];
  for (long long i = 1; i <= n - 1; i++) {
    g[i].push_back(i + 1);
  }
  g[n].push_back(1);
  long long prime = -1;
  for (long long i = n; i <= (n * (n - 1)) / 2; i++) {
    bool isPrime = true;
    for (long long j = 2; j * j <= i; j++) {
      if (i % j == 0) {
        isPrime = false;
        break;
      }
    }
    if (isPrime) {
      prime = i;
      break;
    }
  }
  if (prime == -1) {
    cout << -1 << endl;
    return 0;
  }
  long long left = prime - n;
  for (long long i = 1; i <= n; i++) {
    if (left == 0) break;
    g[i].push_back(i + n / 2);
    left--;
  }
  cout << prime << endl;
  for (long long i = 1; i <= n; i++) {
    for (long long v : g[i]) {
      cout << i << " " << v << endl;
    }
  }
}
