#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > P;
set<pair<int, int> > st;
void solve(int lo, int hi) {
  if (lo >= hi) return;
  int mid = (lo + hi) / 2;
  for (register int i = (lo); i < (int)(hi + 1); ++i)
    st.insert(pair<int, int>(P[mid].first, P[i].second));
  solve(lo, mid);
  solve(mid + 1, hi);
}
int main() {
  int n;
  cin >> n;
  for (register int i = (0); i < (int)(n); ++i) {
    int x, y;
    cin >> x >> y;
    P.push_back(pair<int, int>(x, y));
    st.insert(P.back());
  }
  sort((P).begin(), (P).end());
  solve(0, n - 1);
  cout << ((int)(st).size()) << "\n";
  for (__typeof((st).begin()) it = (st).begin(); it != (st).end(); ++it)
    cout << it->first << " " << it->second << "\n";
  return 0;
}
