#include <bits/stdc++.h>
using namespace std;
long long int p[1000005] = {0};
vector<long long int> prime;
void isp() {
  for (long long int i = 2; i <= 1000002; i++) {
    if (p[i] == 0) {
      p[i] = 1;
      prime.push_back(i);
      for (long long int j = i * i; j <= 1000002; j += i) {
        p[j] = 2;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, i, j, x = -1, y, k = 0, v[1000];
  vector<pair<long long int, long long int> > a;
  cin >> n;
  isp();
  for (i = 1; i < n; i++) {
    a.push_back(make_pair(i, i + 1));
  }
  a.push_back(make_pair(n, 1));
  if (p[a.size()] == 1) {
    cout << a.size() << "\n";
    for (i = 0; i < a.size(); i++) {
      cout << a[i].first << " " << a[i].second << "\n";
    }
    return 0;
  }
  for (i = 1; i < n / 2; i++) {
    a.push_back(make_pair(i, n - i));
    if (p[a.size()] == 1) {
      cout << a.size() << "\n";
      for (i = 0; i < a.size(); i++) {
        cout << a[i].first << " " << a[i].second << "\n";
      }
      return 0;
    }
  }
  if (n % 2 == 0) {
    a.push_back(make_pair(n / 2, n));
    if (p[a.size()] == 1) {
      cout << a.size() << "\n";
      for (i = 0; i < a.size(); i++) {
        cout << a[i].first << " " << a[i].second << "\n";
      }
      return 0;
    }
  }
  cout << -1;
  return 0;
}
