#include <bits/stdc++.h>
using namespace std;
queue<pair<int, int> > del;
set<pair<int, int> > s;
int n, l, r;
void print() { printf("%d%c", (int)s.size(), n ? ' ' : '\n'); }
int main() {
  scanf("%d", &n);
  while (n--) {
    scanf("%d%d", &l, &r);
    if (s.empty()) {
      s.insert(make_pair(l, r));
      print();
      continue;
    }
    auto _ = s.lower_bound(make_pair(l, -233));
    if (_ != s.begin()) {
      _--;
      if ((*_).second >= l) l = (*_).first, r = max(r, (*_).second), s.erase(_);
    }
    _ = s.lower_bound(make_pair(l, -233));
    while (_ != s.end() && r >= (*_).first)
      r = max(r, (*_).second), del.push(*_), _++;
    while (!del.empty()) s.erase(del.front()), del.pop();
    s.insert(make_pair(l, r));
    print();
  }
  return 0;
}
