#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int s, d;
};
int main() {
  int n;
  cin >> n;
  int i, j;
  vector<bool> prime(2020, false);
  for (i = 2; i <= 2000; ++i) {
    for (j = 2; j * j <= i; ++j) {
      if (i % j == 0) break;
    }
    if (j * j > i) {
      prime[i] = true;
    }
  }
  vector<Edge> edges;
  for (int i = 1; i <= n; ++i) {
    edges.push_back({i, i % n + 1});
  }
  int s = 1;
  int e = n / 2 + 1;
  for (int i = n;; ++i) {
    if (prime[i]) break;
    edges.push_back({s, e});
    ++s;
    ++e;
  }
  cout << edges.size() << endl;
  for (Edge& e : edges) {
    cout << e.s << " " << e.d << endl;
  }
  return 0;
}
