typedef long long ll; typedef long double ld; #include <bits/stdc++.h> using namespace std; #define int long long signed main(){ ll n; std::cin >> n; vector<tuple<ll,ll,ll>> xy(n); vector<ll> ans; for (int i = 0; i < n; i++) { ll x,y; std::cin >> x>>y; xy[i] = {x,y,i}; } sort(xy.begin(),xy.end()); std::cout << xy.size()/2 << std::endl; for (int i = 0; i < xy.size()/2; i++) { auto [t1,t2,t3] = xy[2*i]; auto [t12,t22,t32] = xy[2*i+1]; std::cout << t3+1<<" "<<t32+1 << std::endl; } }