#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &x) {
  int f = 0;
  x = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar()) f |= (ch == '-');
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  if (f) x = -x;
}
const int N = 1005;
vector<pair<int, int> > ans;
int n, m;
inline int isp(int x) {
  for (int i = 2; i * i <= x; i++)
    if (x % i == 0) return 0;
  return 1;
}
inline void add(int a, int b) {
  ans.push_back(make_pair(a, b));
  m++;
}
int main() {
  read(n);
  for (int i = (1); i <= (n - 1); i++) add(i, i + 1);
  add(1, n);
  int a = 1, b = n / 2 + 1;
  while (!isp(m)) {
    add(a, b);
    a++, b++;
  }
  printf("%d\n", m);
  for (auto x : ans) printf("%d %d\n", x.first, x.second);
  return 0;
}
