#include <bits/stdc++.h>
using namespace std;
inline int Int() {
  int x;
  scanf("%d", &x);
  return x;
}
inline long long Long() {
  long long x;
  scanf("%lld", &x);
  return x;
}
void err(istream_iterator<string> it) { cout << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ' ';
  err(++it, args...);
}
const int N = (int)2e5 + 5;
const int maxN = (int)1e6 + 6;
const long long Mod = (long long)1e9 + 7;
const int inf = (int)2e9;
const long long Inf = (long long)1e18;
const int mod = (int)1e9 + 7;
inline int add(int a, int b) {
  a += b;
  return a >= mod ? a - mod : a;
}
inline int sub(int a, int b) {
  a -= b;
  return a < 0 ? a + mod : a;
}
inline int mul(int a, int b) { return (long long)a * b % mod; }
int get(int n) {
  if (n == 1) return 0;
  for (int i = 2; i * i <= n; ++i)
    if (n % i == 0) return 0;
  return 1;
}
int main() {
  int test = 1, tc = 0;
  while (test--) {
    int n = Int();
    int x = n + (n / 2), i = n, f = 0, d = 2;
    for (; i <= x; ++i) {
      if (get(i)) {
        break;
      }
      ++f;
    }
    if (i == x + 1) return puts("-1"), 0;
    cout << n + f << '\n';
    for (int i = 1; i < n; ++i) {
      printf("%d %d\n", i, i + 1);
    }
    printf("%d 1\n", n);
    for (int i = 1, j = (n / 2) + 1; f > 0; ++i, ++j, --f) {
      printf("%d %d\n", i, j);
    }
  }
  return 0;
}
