#include <bits/stdc++.h>
using namespace std;
const int maxn = 500000 + 10;
pair<int, int> p[maxn];
vector<pair<int, int> > v;
void solve(int l, int r) {
  if (r - l == 1) return;
  int mid = (l + r) / 2;
  solve(l, mid);
  solve(mid, r);
  for (int i = l; i < r; i++) v.push_back(make_pair(p[mid].first, p[i].second));
  return;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> p[i].first >> p[i].second;
  sort(p, p + n);
  solve(0, n);
  for (int i = 0; i < n; i++) v.push_back(p[i]);
  sort(v.begin(), v.end());
  v.resize(unique(v.begin(), v.end()) - v.begin());
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++)
    cout << v[i].first << " " << v[i].second << endl;
  return 0;
}
