#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e17 + 5;
const long long maxn = 2e5 + 5;
const long long mo_num = 1e9 + 7;
long long n, m, a[maxn], b[maxn], ans;
long long isprime(long long n) {
  if (n == 1) return 0;
  float n_sqrt;
  if (n == 2 || n == 3) return 1;
  if (n % 6 != 1 && n % 6 != 5) return 0;
  n_sqrt = floor(sqrt((float)n));
  for (long long i = 5; i <= n_sqrt; i += 6) {
    if (n % (i) == 0 | n % (i + 2) == 0) return 0;
  }
  return 1;
}
struct node {
  long long x, y;
};
vector<node> t;
void did(long long nn) {
  long long num = nn;
  long long l = nn / 4;
  for (long long i = 1; i <= n - 1; i++) t.push_back({i, i + 1});
  t.push_back({n, 1});
  num -= n;
  if (num)
    for (long long ii = 0; ii <= l - 1; ii++) {
      long long i = ii * 4 + 1;
      t.push_back({i, i + 2});
      num--;
      if (!num) break;
      t.push_back({i + 1, i + 3});
      num--;
      if (!num) break;
    }
  cout << t.size() << '\n';
  for (auto i : t) cout << i.x << " " << i.y << '\n';
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = n; i <= n * (n - 1) / 2; i++) {
    if (isprime(i)) {
      did(i);
      return 0;
    }
  }
  cout << -1;
  return 0;
}
