#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 3;
int n, l, r;
set<pair<int, int> > st;
bool per(int l1, int r1, int l2, int r2) {
  return min(r1, r2) - max(l1, l2) >= 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  set<pair<int, int> >::iterator it, it1;
  for (int i = 1; i <= n; ++i) {
    cin >> l >> r;
    if (st.size() == 0) st.insert(make_pair(l, r));
    it = st.upper_bound(make_pair(l, -1));
    if (it != st.begin()) {
      it--;
      if (!per(it->first, it->second, l, r)) it++;
    }
    while (it != st.end() && per(it->first, it->second, l, r)) {
      it1 = it;
      it1++;
      l = min(l, it->first);
      r = max(r, it->second);
      st.erase(it);
      it = it1;
    }
    st.insert(make_pair(l, r));
    cout << st.size() << " ";
  }
}
