#include <bits/stdc++.h>
using namespace std;
int arr[200000 + 5];
int BIT[200000 + 5];
int n;
int finalans[200000 + 5];
int order[200000 + 5];
int getNext(int i) { return i + (i & (-1 * i)); }
int getParent(int i) { return i - (i & (-1 * i)); }
void updateFenwick(int index) {
  BIT[index] += 1;
  int j = index;
  while (getNext(j) <= n) {
    j = getNext(j);
    BIT[j] += 1;
  }
}
int readFenwick(int index) {
  int ans = BIT[index];
  while (index != 0) {
    index = getParent(index);
    ans += BIT[index];
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  int i;
  cin >> n;
  pair<int, int> s;
  pair<int, int> r;
  pair<int, int> k;
  vector<pair<int, int> > seg;
  vector<pair<int, int> > e;
  vector<pair<int, int> > f;
  BIT[0] = 0;
  for (i = 1; i <= n; i++) {
    cin >> s.first >> s.second;
    seg.push_back(s);
    k.first = s.second;
    k.second = i;
    f.push_back(k);
    BIT[i] = 0;
  }
  sort(seg.begin(), seg.end());
  sort(f.begin(), f.end());
  for (i = 0; i < n; i++) {
    r.first = seg[i].second;
    r.second = i + 1;
    e.push_back(r);
  }
  sort(e.begin(), e.end());
  for (i = 0; i < n; i++) {
    arr[e[i].second] = i + 1;
    order[f[i].second] = i + 1;
  }
  for (i = n; i >= 1; i--) {
    finalans[arr[i]] = readFenwick(arr[i]);
    updateFenwick(arr[i]);
  }
  for (i = 1; i <= n; i++) cout << finalans[order[i]] << "\n";
  return 0;
}
