#include<bits/stdc++.h> #define SINGLE_INPUT #define ll long long #define ull unsigned long long #define N 500005 #define MOD 998244353 usingnamespace std;
template<classt,classu> ostream& operator<<(ostream& os,const pair<t,u>& p) { return os<<'['<<p.first<<", "<<p.second<<']'; } template<classt> ostream& operator<<(ostream& os,const vector<t>& v) { os<<'['; int s = 1; for(auto e:v) { if (s) s = 0; else os << ", "; os << e; } return os<<']'; } template<classt,classu> ostream& operator<<(ostream& os,const map<t,u>& mp){ os<<'{'; int s = 1; for(auto [x,y]:mp) { if (s) s = 0; else os << ", "; os<<x<<": "<<y; } return os<<'}'; }
intisp(int x){ for (int i=2; i*i<=x; i++) { if (x%i == 0) returnfalse; } returntrue; }
voidsol(){ int n; cin >> n; int b = n/2; int p = n; while (!isp(p)) p++; cout << p << "\n"; cout << "1 " << n << "\n"; for (int i=2; i<=n; i++) { cout << i << " " << i-1 << "\n"; } for (int i=1; i<=p-n; i++) { cout << i << " " << i+b << "\n"; } }