#include <bits/stdc++.h>
using namespace std;
int n;
int m = 0;
vector<pair<int, int> > vet;
int v[3000];
bitset<3000> bs;
void sieve() {
  bs[1] = bs[0] = 1;
  for (int i = 2; i < 20000; i++) {
    if (bs[i] == 0) {
      for (int j = 2 * i; j < 2000; j += i) bs[j] = 1;
    }
  }
}
int main() {
  cin >> n;
  m = n - 1;
  sieve();
  for (int i = 0; i < n - 1; i++) {
    vet.emplace_back(i + 1, i + 2);
  }
  vet.emplace_back(1, n);
  m = vet.size();
  while (bs[m]) {
    m++;
    for (int i = 0; i < n - 1; i++) {
      if (v[i] == 0 and v[i + 2] == 0) {
        vet.emplace_back(i + 1, i + 3);
        v[i] = 1;
        v[i + 2] = 1;
        break;
      }
    }
  }
  cout << vet.size() << endl;
  for (auto it : vet) {
    cout << it.first << " " << it.second << endl;
  }
}
