#include <bits/stdc++.h>
using namespace std;
long long int n;
vector<pair<long long int, long long int> > ans;
pair<long long int, long long int> point[200005];
void recur(long long int l, long long int r) {
  if (r <= l) return;
  long long int mid = (l + r) / 2;
  recur(l, mid - 1);
  recur(mid + 1, r);
  for (long long int i = l; i <= r; i++) {
    ans.push_back(make_pair(point[mid].first, point[i].second));
  }
}
int main() {
  cin >> n;
  for (long long int i = 0; i < ((long long int)(n)); i++)
    cin >> point[i].first >> point[i].second;
  sort(point, point + n);
  recur(0, n - 1);
  for (long long int i = 0; i < ((long long int)(n)); i++)
    ans.push_back(point[i]);
  sort(ans.begin(), ans.end());
  ans.erase(unique(ans.begin(), ans.end()), ans.end());
  cout << ((long long int)ans.size()) << endl;
  for (long long int i = 0; i < ((long long int)(((long long int)ans.size())));
       i++)
    cout << ans[i].first << " " << ans[i].second << endl;
}
