#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long n) {
  if (n <= 1)
    return false;
  else {
    for (long long i = 2; i * i <= n; i++)
      if (n % i == 0) return false;
    return true;
  }
}
signed main() {
  long long n;
  cin >> n;
  long long m = n;
  while (!isPrime(m)) m++;
  cout << m << "\n";
  for (long long i = 1; i < n; i++) cout << i << " " << i + 1 << "\n";
  cout << n << " " << 1 << "\n";
  for (long long i = 1; i <= m - n; i++) cout << i << " " << i + n / 2 << "\n";
  return 0;
}
