#include <bits/stdc++.h>
std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
const int N = 6;
int main()
{
int n = N+rng()%N;
std::cout<<n<<"\n";
std::vector<std::array<int,2>> son(n+1, {-1, -1});
for(int i=1, tot=1; i<=n; ++i) {
for(auto &j:son[i]) {
j = ++tot;
if(tot == n) break;
}
if(tot == n) break;
}
for(int i=1; i<=n; ++i) {
std::shuffle(son[i].begin(), son[i].end(), rng);
std::cout<<son[i][0]<<" "<<son[i][1]<<"\n";
}
return 0;
}