#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > S;
set<pair<int, int> >::iterator itr;
int n, l, r, ans;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  while (n--) {
    cin >> l >> r;
    itr = S.lower_bound(make_pair(l, 0));
    ++ans;
    vector<set<pair<int, int> >::iterator> v;
    while ((itr->second) <= r && itr != S.end()) {
      r = max((itr->first), r);
      v.push_back(itr);
      l = min(l, (itr->second));
      ++itr;
      --ans;
    }
    for (int i = 0; i < v.size(); i++) S.erase(v[i]);
    S.insert(make_pair(r, l));
    cout << ans << " ";
  }
}
