#include <bits/stdc++.h>
using namespace std;
bool isPrime(int n) {
  int r = 2;
  while (r * r <= n) {
    if (n % r == 0) return false;
    r++;
  }
  return true;
}
int main() {
  int n;
  cin >> n;
  int nextLargest = n;
  while (!isPrime(nextLargest)) {
    nextLargest++;
  }
  cout << nextLargest << endl;
  for (int i = 1; i < n; i++) {
    cout << i << ' ' << i + 1 << endl;
  }
  cout << n << ' ' << 1 << endl;
  nextLargest -= n;
  int i = 1;
  while (nextLargest--) {
    cout << i << ' ' << i + n / 2 << endl;
    i++;
  }
  return 0;
}
