#include <bits/stdc++.h>
using namespace std;
pair<int, int> in[10010];
set<pair<int, int> > out;
void binup(int l, int r) {
  if (l >= r) return;
  int mid = (l + r) / 2;
  for (int i = l; i < r; i++)
    out.insert(make_pair((in[mid].first), (in[i].second)));
  binup(l, mid);
  binup(mid + 1, r);
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> in[i].first >> in[i].second;
    out.insert(make_pair((in[i].first), (in[i].second)));
  }
  sort(in, in + n);
  binup(0, n);
  cout << out.size() << endl;
  for (pair<int, int> x : out) cout << x.first << " " << x.second << endl;
  return 0;
}
