#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4 + 1;
pair<int, int> pts[maxn];
set<pair<int, int> > s;
void dfs(int l, int r) {
  if (l == r) return;
  int m = (l + r) >> 1;
  dfs(l, m);
  dfs(m + 1, r);
  int x = pts[m].first;
  for (int i = l; i <= r; ++i) {
    s.insert({x, pts[i].second});
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> pts[i].first >> pts[i].second;
    s.insert(pts[i]);
  }
  sort(pts + 1, pts + 1 + n);
  dfs(1, n);
  cout << s.size() << "\n";
  for (auto it = s.begin(); it != s.end(); ++it)
    cout << it->first << " " << it->second << "\n";
}
