#include <bits/stdc++.h>
bool is_prime(int n) {
  if (n < 2) {
    return false;
  }
  for (int d = 2; d * d <= n; d++) {
    if (n % d == 0) {
      return false;
    }
  }
  return true;
}
int main() {
  int n;
  std::cin >> n;
  int m = n, cross = 0;
  while (!is_prime(m + cross)) {
    cross++;
  }
  assert(2 * cross <= n);
  std::cout << m + cross << std::endl;
  for (int i = 1; i <= n; i++) {
    std::cout << i << ' ' << i % n + 1 << std::endl;
  }
  int jump = std::max(2, cross);
  for (int i = 1; i <= cross; i++) {
    assert(i < 1 + jump);
    assert(i + jump <= n);
    std::cout << i << ' ' << i + jump << std::endl;
  }
}
