#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, mn_prime = 0;
  cin >> n;
  vector<bool> sieve(100000, false);
  vector<pair<int, int> > ar;
  for (int i = 2; i < 100000; i++) {
    if (!sieve[i]) {
      if (i >= n) {
        mn_prime = i;
        break;
      }
      for (int j = i; j < 100000; j += i) {
        sieve[j] = 1;
      }
    }
  }
  if (mn_prime == 0) {
    cout << -1;
    return 0;
  }
  for (int i = 1; i <= n - 1; i++) {
    ar.push_back({i, i + 1});
  }
  ar.push_back({1, n});
  if (mn_prime > n) {
    for (int i = 1; i <= n and mn_prime > n; i++) {
      ar.push_back({i, i + n / 2});
      mn_prime--;
    }
  }
  if (sieve[ar.size()]) {
    cout << -1;
    return 0;
  }
  cout << ar.size() << "\n";
  for (pair<int, int> x : ar) cout << x.first << " " << x.second << "\n";
  return 0;
}
