#include <bits/stdc++.h>
using namespace std;
int p(int x) {
  for (int i = 2; i <= sqrt(x) + 1; i++) {
    if (x % i == 0) {
      return 0;
    }
  }
  return 1;
}
int main() {
  int n, k = 1;
  vector<pair<int, int> > a;
  cin >> n;
  for (int i = 0; i != n - 1; i++) {
    a.push_back({i + 1, i + 2});
  }
  a.push_back({n, 1});
  while (p(a.size()) == 0) {
    a.push_back({k, k + n / 2});
    k++;
  }
  cout << a.size() << endl;
  for (int i = 0; i != a.size(); i++) {
    cout << a[i].first << " " << a[i].second << endl;
  }
  return 0;
}
