#include <bits/stdc++.h>
using namespace std;
long long int n, t;
bool prime[10005];
vector<int> v;
void SieveOfEratosthenes(int n) {
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));
  for (int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  for (int p = 2; p <= n; p++)
    if (prime[p]) v.push_back(p);
}
int main() {
  cin >> n;
  SieveOfEratosthenes(1010);
  int i = 0;
  while (v[i] < n) i += 1;
  int df = v[i] - n;
  cout << v[i] << endl;
  for (int i = 1; i < n; i++) {
    cout << i << " " << i + 1 << endl;
  }
  cout << 1 << " " << n << endl;
  int j = 1;
  while (df > 0) {
    cout << j << " " << j + 2 << endl;
    if (j % 2)
      j += 1;
    else
      j += 3;
    df -= 1;
  }
  return 0;
}
