#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l, int r) { return l + rng() % (r - l + 1); }
const int N = 200010;
int n;
struct tp {
  int x, y, i;
} x[N];
int bit[N * 2], ans[N];
vector<int> val;
void upd(int i) {
  for (; i <= val.size(); i += i & -i) bit[i]++;
}
int que(int i) {
  int ret = 0;
  for (; i; i -= i & -i) ret += bit[i];
  return ret;
}
int main() {
  n = ({
    int x = 0;
    int c = getchar(), n = 0;
    for (; !isdigit(c); c = getchar()) n = (c == '-');
    for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
    n ? -x : x;
  });
  for (int i = 1, _c = n; i <= _c; ++i) {
    x[i] = {({
              int x = 0;
              int c = getchar(), n = 0;
              for (; !isdigit(c); c = getchar()) n = (c == '-');
              for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
              n ? -x : x;
            }),
            ({
              int x = 0;
              int c = getchar(), n = 0;
              for (; !isdigit(c); c = getchar()) n = (c == '-');
              for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
              n ? -x : x;
            }),
            i};
    val.insert(val.end(), {x[i].x, x[i].y});
  }
  sort(val.begin(), val.end());
  for (int i = 1, _c = n; i <= _c; ++i) {
    x[i].x = lower_bound(val.begin(), val.end(), x[i].x) - val.begin() + 1;
    x[i].y = lower_bound(val.begin(), val.end(), x[i].y) - val.begin() + 1;
  }
  sort(x + 1, x + n + 1, [](tp i, tp j) { return i.x > j.x; });
  for (int i = 1, _c = n; i <= _c; ++i) {
    ans[x[i].i] = que(x[i].y);
    upd(x[i].y);
  }
  for (int i = 1, _c = n; i <= _c; ++i) cout << ans[i] << "\n";
}
