#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
long long n;
vector<int> d[100005];
long long min(long long a, long long b) {
  if (a < b)
    return a;
  else
    return b;
}
long long max(long long a, long long b) {
  if (a > b)
    return a;
  else
    return b;
}
long long power(long long x, long long y) {
  int res = 1;
  x = x % mod;
  while (y > 0) {
    if (y & 1) res = (res * x) % mod;
    y = y >> 1;
    x = (x * x) % mod;
  }
  return res;
}
vector<bool> prime(2000, 0);
void sol() {
  cin >> n;
  prime[0] = prime[1] = 1;
  for (int i = 2; i < 2000; ++i)
    if (!prime[i])
      for (int k = 2; i * k < 2000; ++k) prime[i * k] = 1;
  long long b = -1;
  for (int i = n; i < 2000; ++i)
    if (prime[i] == 0) {
      b = i;
      break;
    }
  cout << b << endl;
  for (int i = 1; i < n; ++i) cout << i << " " << i + 1 << endl;
  cout << n << " " << 1 << endl;
  b = b - n;
  int i = 1;
  while (b && i < n / 2) {
    cout << i << " " << i + n / 2 << endl;
    ++i;
    --b;
  }
}
int main() {
  int t = 1;
  while (t--) {
    sol();
  }
}
