#include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(T x) {
  cout << x << endl;
  exit(0);
}
using ll = long long;
const ll mod = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 1e9;
struct interval_set {
  set<pair<int, int>> st;
  void add_interval(int l, int r) {
    auto iter = st.lower_bound({l, -inf});
    auto iter2 = iter;
    while (iter2 != st.end() && r >= iter2->second) {
      l = min(l, iter2->second);
      r = max(r, iter2->first);
      ++iter2;
    }
    st.erase(iter, iter2);
    st.insert({r, l});
  }
  int size() { return st.size(); }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  interval_set st;
  int n;
  cin >> n;
  while (n--) {
    int l, r;
    cin >> l >> r;
    st.add_interval(l, r);
    cout << st.size() << " ";
  }
  cout << endl;
  return 0;
}
