#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
set<pair<int, int>> s;
pair<int, int> a[N];
int n;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int l, r;
    cin >> l >> r;
    while (s.size()) {
      auto it = s.lower_bound(make_pair(l, 0));
      if (it == s.begin()) break;
      it--;
      int u = (*it).first;
      int v = (*it).second;
      if (v < l) break;
      l = u;
      r = max(r, v);
      s.erase(it);
    }
    while (s.size()) {
      auto it = s.lower_bound(make_pair(l, 0));
      if (it == s.end()) break;
      int u = (*it).first;
      int v = (*it).second;
      if (u > r) break;
      r = max(r, v);
      s.erase(it);
    }
    s.insert(make_pair(l, r));
    cout << s.size() << " ";
  }
  return 0;
}
