#include <bits/stdc++.h>
using namespace std;
int const N = 1e4 + 20;
int n;
pair<int, int> p[N], a[N], b[N];
vector<pair<int, int> > v;
void solve(int s = 0, int e = n) {
  if (e - s < 2) return;
  int mid = s + e >> 1;
  solve(s, mid);
  solve(mid, e);
  for (int i = s; i < e; i++) v.push_back({p[mid].first, p[i].second});
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i].first >> p[i].second;
    v.push_back({p[i].first, p[i].second});
  }
  sort(p, p + n);
  solve();
  sort(v.begin(), v.end());
  v.resize(unique(v.begin(), v.end()) - v.begin());
  cout << v.size() << '\n';
  for (auto x : v) cout << x.first << ' ' << x.second << '\n';
}
