#include using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); int n; cin >> n; if (n <= 2) { cout << -1 << '\n'; } else { const int m = n * n; vector> v; rep(i, m) { v.push_back({ i, (i - 1 + m) % m }); v.push_back({ i, (i + 1 + m) % m }); v.push_back({ i, (i - n + m) % m }); v.push_back({ i, (i + n + m) % m }); } for (auto&& [x, y] : v) if (x > y) swap(x, y); set> st(v.begin(), v.end()); cout << st.size() << '\n'; for (auto [x, y] : st) cout << x + 1 << ' ' << y + 1 << '\n'; } return 0; }