#include <bits/stdc++.h>
using namespace std;
bool Prime(int a) {
  for (int i = 2; i <= sqrt(a); i++) {
    if (a % i == 0) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int l = n, h = n + n / 2;
  for (int i = l; i < (h + 1); i++) {
    if (Prime(i)) {
      cout << i << endl;
      for (int j = 1; j < (n); j++) {
        cout << j << " " << j + 1 << endl;
      }
      cout << n << " " << 1 << endl;
      i -= n;
      for (int j = 0; j < (i); j++) {
        int a = j + 1, b = n - a;
        if (a == b) b = n;
        cout << a << " " << b << endl;
      }
      return 0;
    }
  }
  cout << -1 << endl;
}
