#include <bits/stdc++.h>
using namespace std;
int a[200];
void prime() {
  int i, j, k, c;
  a[0] = 2;
  i = 3;
  k = 1;
  while (a[k - 1] < 1050) {
    c = 1;
    for (j = 2; j <= sqrt(i); j++) {
      if (i % j == 0) {
        c = 0;
        break;
      }
    }
    if (c == 1) {
      a[k] = i;
      k++;
    }
    i++;
  }
}
int main() {
  int n, i, k;
  cin >> n;
  prime();
  i = 0;
  while (n > a[i]) i++;
  k = a[i];
  cout << k << endl;
  for (i = 0; i < n - 1; i++) cout << i + 1 << " " << i + 2 << endl;
  cout << 1 << " " << n << endl;
  k -= n;
  i = 1;
  while (k--) {
    cout << i << " " << i + n / 2 << endl;
    i++;
  }
}
