#include <bits/stdc++.h>
using namespace std;
vector<int> primes;
void sieve() {
  int i, j;
  bitset<1010> bs;
  bs.set();
  bs[0] = bs[1] = 0;
  for (i = 2; i <= 1010; i++) {
    if (bs[i] == 1) {
      for (j = i * i; j <= 1010; j += i) bs[j] = 0;
      primes.push_back(i);
    }
  }
}
int main() {
  int i, n, j;
  sieve();
  cin >> n;
  vector<int>::iterator it;
  it = lower_bound(primes.begin(), primes.end(), n);
  int index = it - primes.begin();
  cout << primes[index] << '\n';
  for (i = 1; i < n; i++) cout << i << ' ' << i + 1 << '\n';
  cout << n << " 1\n";
  j = 1;
  for (i = n; i < primes[index]; i++) {
    if (i != n && (i - n) % 2 == 0) j += 2;
    cout << j << ' ' << j + 2 << '\n';
    j++;
  }
}
