#include <bits/stdc++.h>
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  int32_t n;
  std::cin >> n;
  std::set<std::pair<int32_t, int32_t> > segments;
  for (int32_t i = 0; i < n; i++) {
    int32_t left, right;
    std::cin >> left >> right;
    auto it = segments.lower_bound({left, 0});
    if (it != segments.begin()) {
      it--;
      if (it->second < left) it++;
    }
    int32_t min_left = left, max_right = right;
    while (it != segments.end() &&
           ((it->second >= left && it->second <= right) ||
            (it->first >= left && it->first <= right) ||
            (it->first <= left && it->second >= right))) {
      min_left = std::min(min_left, it->first);
      max_right = std::max(max_right, it->second);
      auto next = it;
      next++;
      segments.erase(it);
      it = next;
    }
    segments.emplace(min_left, max_right);
    std::cout << segments.size() << " ";
  }
  return 0;
}
