#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10 * 1000 + 10;
vector<pair<int, int> > vec;
int n;
void F(int second, int e) {
  if (e - second <= 1) return;
  int mid = (e + second) / 2;
  F(second, mid);
  F(mid + 1, e);
  int x = vec[mid].first;
  int sz = vec.size();
  for (int i = second; i < e; i++) vec.push_back(make_pair(x, vec[i].second));
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    vec.push_back(make_pair(a, b));
  }
  sort(vec.begin(), vec.end());
  F(0, n);
  sort(vec.begin(), vec.end());
  vector<pair<int, int> >::iterator it;
  it = unique(vec.begin(), vec.end());
  vec.resize(distance(vec.begin(), it));
  cout << vec.size() << endl;
  for (int i = 0; i < vec.size(); i++)
    cout << vec[i].first << " " << vec[i].second << endl;
}
