#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    int ns = a, ne = b;
    auto start = s.lower_bound(pair<int, int>(a, 0));
    while (start != s.end() and (*start).second <= b) {
      ns = min(ns, (*start).second);
      ne = max(ne, (*start).first);
      start = s.erase(start);
    }
    s.insert(pair<int, int>(ne, ns));
    cout << s.size() << " ";
  }
}
