#include #define all(v) v.begin(), v.end() #define eb emplace_back #define fast cin.tie(nullptr); ios_base::sync_with_stdio(false) using namespace std; using ll = long long; using ull = unsigned long long; constexpr ll mod = 998244353; int n; int f(int r,int c){ return r * n + c + 1; } int main(){ cin >> n; if(n <= 2){ cout << -1 << endl; return 0; } int m = n * n; vector> g(m + 1); for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ int u = f(i, j); int v1 = f((2 * i) % n, (2 * j) % n); int v2 = f((2 * i) % n, (2 * j + 1) % n); int v3 = f((n - 2 + i) % n, (n - 2 + j) % n); int v4 = f((n - 1 + i) % n, (n - 1 + j) % n); g[u].eb(v1); g[u].eb(v2); g[u].eb(v3); g[u].eb(v4); } } cout << m * 2 << endl; for(int i = 1; i <= m; i++){ for(auto to : g[i]){ if(i < to)cout << i << " " << to << endl; } } return 0; }