#include <bits/stdc++.h>
using namespace std;
const int maxm = 200010;
int n, m;
int e_u[maxm], e_v[maxm];
int checkp(int x) {
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) return 0;
  }
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    ++m;
    e_u[m] = i;
    e_v[m] = i + 1;
  }
  ++m;
  e_u[m] = n;
  e_v[m] = 1;
  int u1 = 1, u2 = n - 1;
  while (!checkp(m)) {
    ++m;
    e_u[m] = u1++;
    e_v[m] = u2--;
  }
  printf("%d\n", m);
  for (int i = 1; i <= m; i++) printf("%d %d\n", e_u[i], e_v[i]);
  return 0;
}
