#include <bits/stdc++.h>
using namespace std;
bool isprime(int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, number = 0, arr[1000] = {0};
  cin >> n;
  for (int j = n; j <= 2 * n; j++) {
    if (isprime(j)) {
      number = j;
      break;
    }
  }
  cout << number << endl;
  number -= n;
  for (int i = 1; i <= n; i++) {
    if (i == n)
      cout << 1 << " " << n << endl;
    else
      cout << i << " " << i + 1 << endl;
  }
  for (int i = 1; i <= number; i++) cout << i << " " << i + (n / 2) << endl;
}
