#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 50;
const int oo = 1e9;
map<pair<int, int>, int> pos;
map<int, int> ans;
vector<pair<int, int>> s;
vector<int> a;
int bit[2 * N], e[2 * N];
void add(int idx) {
  while (idx < 2 * N) {
    bit[idx]++;
    idx += idx & -idx;
  }
}
int sum(int idx) {
  int res = 0;
  while (idx > 0) {
    res += bit[idx];
    idx -= idx & -idx;
  }
  return res;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    s.push_back({x, y});
    a.push_back(x);
    a.push_back(y);
    pos[{x, y}] = i;
  }
  sort(s.begin(), s.end());
  sort(a.begin(), a.end());
  unique(a.begin(), a.end());
  int ct = 1;
  for (int i = 0; i < a.size(); i++) {
    ans[a[i]] = ct;
    ct++;
  }
  for (int i = n - 1; i >= 0; i--) {
    e[pos[{s[i].first, s[i].second}]] = sum(ans[s[i].second]);
    add(ans[s[i].second]);
  }
  for (int i = 0; i < n; i++) {
    printf("%d\n", e[i]);
  }
}
