#include <bits/stdc++.h>
using namespace std;
set<pair<int, int>> s;
pair<int, int> a[10005];
void bs(int l, int r) {
  int mid = l + r >> 1;
  for (int i = l; i < r; i++) s.insert({a[mid].first, a[i].second});
  if (r - l > 1) bs(l, mid), bs(mid, r);
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i].first >> a[i].second;
  sort(a, a + n), bs(0, n), cout << s.size() << endl;
  for (auto x : s) cout << x.first << ' ' << x.second << endl;
}
