#include <bits/stdc++.h>
using namespace std;
const long long int mod = 998244353;
const int maxn = 1500;
int prim[maxn];
int vis[maxn];
int st;
void pri() {
  st = 0;
  memset(vis, 0, sizeof(vis));
  for (int i = 2; i <= 1400; i++) {
    if (vis[i] == 0) {
      prim[st++] = i;
      for (int j = 1; j * i <= 1400; j++) {
        vis[j * i] = 1;
      }
    }
  }
  return;
}
int main() {
  pri();
  int n;
  scanf("%d", &n);
  int ans = 0;
  for (int i = 0; i < st; i++) {
    if (prim[i] >= n) {
      ans = prim[i];
      break;
    }
  }
  int mm = ans - n;
  printf("%d\n", ans);
  for (int i = 1; i <= n; i++) {
    if (i == 1)
      printf("%d %d\n", 1, n);
    else
      printf("%d %d\n", i - 1, i);
  }
  int ss = 1;
  int qq = n - 1;
  while (mm) {
    printf("%d %d\n", ss, qq);
    ss++;
    qq--;
    mm--;
  }
}
