#include <bits/stdc++.h>
using namespace std;
int p[2000] = {0};
void sieve() {
  for (int i = 0; i < (2000); i++) p[i] = 1;
  p[0] = p[1] = 0;
  for (int i = 2; i < 1000; i++) {
    if (p[i] == 1) {
      for (int j = i * 2; j < 2000; j += i) p[j] = 0;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  sieve();
  int n;
  cin >> n;
  int e;
  for (int i = n; i < 2000; i++)
    if (p[i] == 1) {
      e = i;
      break;
    }
  int m = n + (e - n);
  cout << m << "\n";
  for (int i = 1; i <= n; i++) {
    cout << i << " ";
    if (i == n)
      cout << "1"
           << "\n";
    else
      cout << i + 1 << "\n";
  }
  int d = n / 2;
  d = d + 1;
  for (int i = 0; i < (e - n); i++) {
    cout << i + 1 << " " << d << "\n";
    d++;
  }
}
