#include <bits/stdc++.h>
using namespace std;
struct Data {
  int l, r, id, cnt;
  Data() : l(0), r(0), id(0), cnt(0) {}
};
void mergeSort(vector<Data> &v, int l, int r) {
  if (l == r) return;
  int m = l + r >> 1;
  mergeSort(v, l, m);
  mergeSort(v, m + 1, r);
  int j = l;
  for (int i = m + 1; i <= r; i++) {
    while (j <= m && v[j].l < v[i].l) j++;
    v[i].cnt += m + 1 - j;
  }
  vector<Data> u(r - l + 1);
  merge(v.begin() + l, v.begin() + m + 1, v.begin() + m + 1, v.begin() + r + 1,
        u.begin(), [](Data a, Data b) { return a.l < b.l; });
  for (int i = 0; i < r - l + 1; i++) v[l + i] = u[i];
}
int main() {
  int n;
  scanf("%d", &n);
  vector<Data> v(n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &v[i].l, &v[i].r);
    v[i].id = i;
  }
  sort(v.begin(), v.end(), [](Data a, Data b) { return a.r < b.r; });
  mergeSort(v, 0, n - 1);
  sort(v.begin(), v.end(), [](Data a, Data b) { return a.id < b.id; });
  for (auto d : v) printf("%d\n", d.cnt);
  return 0;
}
