#include using namespace std; using ll = long long int; using ld = long double; #define pow(n,m) powl(n,m) #define sqrt(n) sqrtl(n) const ll MAX = 5000000000000000000; const ll MOD = 1000000007; void randinit(){srand((unsigned)time(NULL));} int main(){ ll N; cin >> N; N--; if(N % 2 == 1){ vector A,B; for(ll i = 0;i < (N - 1) / 2;i++){ for(ll j = 0;j < N - 1 - i * 2;j++){ A.emplace_back(i); B.emplace_back(i + 1 + j); } } cout << A.size() << endl; for(ll i = 0;i < A.size();i++) cout << A[i] + 1 << " " << B[i] + 1 << endl; } else{ vector A,B; for(ll i = 0;i < N / 2;i++){ for(ll j = 0;j < N - 1 - i * 2;j++){ A.emplace_back(i); B.emplace_back(i + 1 + j); } } cout << A.size() << endl; for(ll i = 0;i < A.size();i++) cout << A[i] + 1 << " " << B[i] + 1 << endl; } }