#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
bool ciur[N * N];
int main() {
  for (int i = 2; i <= 1000000; i++)
    if (!ciur[i])
      for (int j = 2 * i; j <= 1000000; j += i) ciur[j] = 1;
  int n;
  cin >> n;
  vector<pair<int, int> > ans;
  for (int i = 1; i < n; i++) ans.push_back({i, i + 1});
  ans.push_back({n, 1});
  int from = 1, to = n - 1;
  for (int i = n;; i++) {
    if (!ciur[i]) break;
    ans.push_back({from, to});
    from++;
    to--;
  }
  cout << ans.size() << "\n";
  for (auto it : ans) cout << it.first << " " << it.second << "\n";
}
