#include <bits/stdc++.h>
using namespace std;
int n;
set<pair<int, int> > s;
set<pair<int, int> >::iterator it;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) x = (x + (x << 2) << 1) + (ch ^ 48);
  return x * f;
}
inline void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 ^ 48);
}
int main() {
  n = read();
  while (n--) {
    int x = read(), y = read();
    it = s.lower_bound(make_pair(x, y));
    while (it != s.end() && (*it).first <= y) {
      y = max(y, (*it).second), s.erase(it);
      it = s.lower_bound(make_pair(x, y));
    }
    if (it != s.begin()) {
      it--;
      while ((*it).second >= x) {
        x = min(x, (*it).first), y = max(y, (*it).second), s.erase(it);
        it = s.lower_bound(make_pair(x, y));
        if (it == s.begin()) break;
        it--;
      }
    }
    s.insert(make_pair(x, y));
    write(s.size()), putchar('\n');
  }
  return 0;
}
