#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  set<pair<int, int> > comp;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int l, r;
    cin >> l >> r;
    while (1) {
      auto ii = comp.lower_bound({l, 0});
      if (ii != comp.end() && r >= ii->second) {
        l = min(l, ii->second);
        r = max(r, ii->first);
        comp.erase(ii);
      } else
        break;
    }
    comp.insert({r, l});
    cout << comp.size() << ' ';
  }
}
