#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  set<pair<int, int> > s;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int l, r, a_L, a_R;
    cin >> l >> r;
    a_L = l, a_R = r;
    if (s.size()) {
      set<pair<int, int> >::iterator j = s.lower_bound({a_L, -a_L}), b, vvvv;
      vector<set<pair<int, int> >::iterator> gg;
      b = j;
      if (j != s.begin()) {
        j--;
        while ((*j).second >= a_L && (*j).first <= a_L) {
          a_L = min((*j).first, a_L);
          a_R = max((*j).second, a_R);
          gg.push_back(j);
          if (j != s.begin())
            j--;
          else
            break;
        }
      }
      while (b != s.end() && (*b).first <= a_R) {
        a_R = max((*b).second, a_R);
        a_L = min((*b).first, a_L);
        gg.push_back(b);
        b++;
      }
      int nnnnnn = gg.size() - 1;
      for (int mmm = nnnnnn; mmm >= 0; mmm--) s.erase(gg[mmm]);
    }
    s.insert({a_L, a_R});
    cout << s.size() << '\n';
  }
}
