/*
这两天就把自己做过的题整理一下吧,比较悲剧的是题目的名字没有记录
*/
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
#define MAXN 32005
int n,c[MAXN],num[MAXN],inx[MAXN],sorted[MAXN],xhash[MAXN];
inline int lowbit(int x)
{
return x&(-x);
}
inline void update(int x,int delta)
{
while(x<=n)
{
c[x]+=delta;
x+=lowbit(x);
}
}
inline int getSum(int x)
{
int s=0;
while(x>0)
{
s+=c[x];
x-=lowbit(x);
}
return s;
}
int main()
{
int i,idx,x,y;
while(scanf("%d",&n)!=EOF)
{
memset(c,0,sizeof(*c)*(n+1));
memset(num,0,sizeof(*num)*(n+1));
idx = 1;
for(i=0; i<n; i++)
{
scanf("%d %d",&inx[i],&y);
sorted[i]=inx[i];
}
sort(sorted,sorted+n);
xhash[ sorted[0] ] = idx++;
for(i=1; i<n; i++)
{
if(sorted[i] != sorted[i-1])
{
xhash[ sorted[i] ] = idx++;
}
}
for(i=0; i<n; i++)
{
x = xhash[ inx[i] ];
num[getSum(x)]++;
update(x,1);
}
for(i=0; i<n; i++) printf("%d\n",num[i]);
}
return 0;
}