#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 998244353;
bool prime(int k) {
  for (int i = 2; i * i <= k; ++i)
    if (k % i == 0) return 0;
  return 1;
}
int main() {
  int n;
  scanf("%d", &n);
  int m = n;
  while (!prime(m)) ++m;
  printf("%d\n", m);
  for (int i = 1; i <= n; ++i) printf("%d %d\n", i, i % n + 1);
  for (int i = n + 1; i <= m; ++i)
    printf("%d %d\n", (i - 1) % n + 1, (i + n / 2 - 1) % n + 1);
}
