#include <bits/stdc++.h>
using namespace std;
const int sz = 1100;
int n;
bool izpr(int n) {
  if (n == 0) return 0;
  if (n == 1) return 0;
  if (n == 2) return 1;
  if (n % 2 == 0) return 0;
  for (int i = 3; i * i <= n; i += 2)
    if (n % i == 0) return 0;
  return 1;
}
bool d[sz];
int main() {
  cin >> n;
  vector<pair<int, int> > g;
  for (int i = 1; i < n; i++) g.push_back({i, i + 1});
  g.push_back({n, 1});
  while (!izpr(g.size())) {
    bool done = false;
    for (int i = 1; i <= n; i++) {
      if (done) break;
      if (d[i]) continue;
      for (int j = 1; j <= n; j++) {
        if (j == i) continue;
        if (j == n && i == 1) continue;
        if (abs(i - j) == 1) continue;
        if (d[j]) continue;
        d[i] = d[j] = 1;
        g.push_back({i, j});
        done = true;
        break;
      }
    }
  }
  cout << g.size() << endl;
  for (int i = 0; i < g.size(); i++)
    cout << g[i].first << " " << g[i].second << endl;
}
