#include <bits/stdc++.h>
using namespace std;
bool isprime(long long x) {
  if (x < 2) {
    return false;
  }
  for (long long i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      return false;
    }
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  long long m = n;
  while (!isprime(m)) {
    m++;
  }
  cout << m << "\n";
  for (long long i = 0; i < n; i++) {
    cout << ((i) % n) + 1 << " " << ((i + 1) % n) + 1 << "\n";
  }
  for (long long i = 0; i < m - n; i++) {
    cout << (i % n) + 1 << " " << (i + (n / 2)) % n + 1 << "\n";
  }
}
