#include using namespace std; #ifdef _DEBUG #include "_DEBUG.hpp" #endif #define int long long const long long inf = 2e18; const int mod = 1e9 + 7; template istream &operator>>(istream &is, vector &v) { for (T &in : v) is >> in; return is; } template vector make_vec(size_t a) { return vector(a); } template auto make_vec(size_t a, Ts... ts) { return vector(ts...))>(a, make_vec(ts...)); } template typename enable_if::value == 0>::type fill(T &t, const V &v) { t = v; } template typename enable_if::value != 0>::type fill(T &t, const V &v) { for (auto &e : t) fill(e, v); } signed main() { int n; cin >> n; vector> ans; vector used(n, false); vector cnt(n, 0); int low = n - 1; for (int i = 0; i < n; i++) { used[i] = true; for (int j = 0; j < n; j++) { if (cnt[i] >= low) break; if (!used[j]) { ans.push_back({i + 1, j + 1}); cnt[i]++; cnt[j]++; } } low--; } cout << ans.size() << endl; for (auto p : ans) { cout << p.first << " " << p.second << endl; } return 0; }