#include <bits/stdc++.h>
using namespace std;
int isprime(int q) {
  for (int i = 2; i < q; i++) {
    if (q % i == 0) {
      return 0;
    }
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int> > adj;
  for (int i = 1; i < n; i++) {
    adj.push_back(make_pair(i, i + 1));
  }
  adj.push_back(make_pair(1, n));
  for (int i = n; i <= 3 * n / 2; i++) {
    if (isprime(i) == 1) {
      cout << i << endl;
      for (int j = 0; j < adj.size(); j++) {
        cout << adj[j].first << " " << adj[j].second << endl;
      }
      return 0;
    } else {
      adj.push_back(make_pair(i - n + 1, i - n + 1 + n / 2));
    }
  }
  return 0;
}
