#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e4 + 5;   pair<int, int> p[maxn];   set<pair<int, int> > s;   void solve(int l, int r) {     if (r - l < 2) return;     int mid = (l + r) / 2;     solve(l, mid), solve(mid, r);     for (int i = l; i < r; i++) s.insert(make_pair(p[mid].first, p[i].second));   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     for (int i = 0; i < n; i++)       cin >> p[i].first >> p[i].second,           s.insert(make_pair(p[i].first, p[i].second));     sort(p, p + n);     solve(0, n);     cout << s.size() << endl;     for (pair<int, int> now : s) cout << now.first <<     << now.second << endl;     return 0;   }   