#include <bits/stdc++.h>
using namespace std;
template <typename T>
T in() {
  char ch;
  T n = 0;
  bool ng = false;
  while (1) {
    ch = (char)getchar();
    if (ch == '-') {
      ng = true;
      ch = (char)getchar();
      break;
    }
    if (ch >= '0' && ch <= '9') break;
  }
  while (1) {
    n = n * 10 + (ch - '0');
    ch = (char)getchar();
    if (ch < '0' || ch > '9') break;
  }
  return (ng ? -n : n);
}
template <typename T>
inline T POW(T B, T P) {
  if (P == 0) return 1;
  if (P & 1)
    return B * POW(B, P - 1);
  else
    return (POW(B, P / 2) * POW(B, P / 2));
}
template <typename T>
inline T Gcd(T a, T b) {
  if (a < 0) return Gcd(-a, b);
  if (b < 0) return Gcd(a, -b);
  return (b == 0) ? a : Gcd(b, a % b);
}
template <typename T>
inline T Lcm(T a, T b) {
  if (a < 0) return Lcm(-a, b);
  if (b < 0) return Lcm(a, -b);
  return a * (b / Gcd(a, b));
}
long long Bigmod(long long base, long long power, long long MOD) {
  long long ret = 1;
  while (power) {
    if (power & 1) ret = (ret * base) % MOD;
    base = (base * base) % MOD;
    power >>= 1;
  }
  return ret;
}
bool isVowel(char ch) {
  ch = (char)toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
template <typename T>
long long isLeft(T a, T b, T c) {
  return (a.x - b.x) * (b.y - c.y) - (b.x - c.x) * (a.y - b.y);
}
long long ModInverse(long long number, long long MOD) {
  return Bigmod(number, MOD - 2, MOD);
}
bool isConst(char ch) {
  if (isalpha(ch) && !isVowel(ch)) return true;
  return false;
}
long long toInt(string s) {
  long long sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
bool isPrime(long long val) {
  if (val == 2) return true;
  if (val % 2 == 0 || val == 1) return false;
  long long sqrt_N = (long long)((double)sqrt(val));
  for (long long i = 3; i <= sqrt_N; i += 2) {
    if (val % i == 0) return false;
  }
  return true;
}
template <class T>
string convert(T _input) {
  stringstream blah;
  blah << _input;
  return blah.str();
}
void faster(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
int32_t main() {
  faster();
  long long i, n, m, j;
  cin >> n;
  m = n + n / 2;
  for (i = n; i <= m; i++) {
    if (isPrime(i)) {
      cout << i << endl;
      for (j = 1; j < n; j++) cout << j << ' ' << j + 1 << endl;
      cout << 1 << ' ' << n << endl;
      i -= n;
      long long cnt = 1, cou = 0;
      if (!i) exit(0);
      while (true) {
        cou++;
        if (i == 1) {
          cout << cnt << ' ' << cnt + 2 << endl;
          break;
        }
        cout << cnt << ' ' << cnt + 2 << endl;
        cout << cnt + 1 << ' ' << cnt + 3 << endl;
        cnt += 4;
        if (i == 2) break;
        i -= 2;
      }
      exit(0);
    }
  }
  cout << -1 << endl;
  return 0;
}
