#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const ll inf = 1e9 + 7;
set<pii> ranges;
bool contains(int pt, const pair<int, int>& p) {
  return p.first <= pt && pt <= p.second;
}
set<pii>::iterator get_range(int pt) {
  pii elem = {pt, pt};
  auto item = ranges.lower_bound(elem);
  if (item != ranges.begin()) --item;
  if (item != ranges.end() && (*item).second < pt) ++item;
  if (item == ranges.end() || !contains(pt, *item)) return ranges.end();
  return item;
}
void add_range(pii p) {
  auto l_ptr = get_range(p.first), r_ptr = get_range(p.second);
  int l, r;
  if (l_ptr == ranges.end())
    l = p.first;
  else
    l = (*l_ptr).first;
  if (r_ptr == ranges.end())
    r = p.second;
  else
    r = (*r_ptr).second;
  set<pii>::iterator s, f;
  if (l_ptr != ranges.end() && contains(p.first, *l_ptr)) {
    s = l_ptr;
  } else {
    s = ranges.lower_bound({p.first, p.first});
  }
  f = ranges.upper_bound({p.second + 1, p.second});
  ranges.erase(s, f);
  ranges.insert({l, r});
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  cin >> n;
  for (int l, r; n--;) {
    cin >> l >> r;
    add_range({l, r});
    cout << ranges.size() << "\n";
  }
}
