#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  set<pair<long long, long long> > st;
  long long cnt = 0;
  for (long long i = 1; i <= n; i++) {
    long long l, r;
    cin >> l >> r;
    auto it = st.lower_bound({l, r});
    if (it != st.begin()) {
      it--;
      if (it->second < l) {
        it++;
      }
    }
    long long le = l, ri = r;
    while (it != st.end() && it->first <= r) {
      le = min(it->first, le);
      ri = max(it->second, ri);
      it = st.erase(it);
    }
    st.insert({le, ri});
    cout << st.size() << " ";
  }
  cout << endl;
  return 0;
}
