/*
#include <stdio.h>
int ar[100000]={};
int sum=0;
int n,m=0,a=0;
int bs(int k)
{
m=m+ar[a];
if (m==k) sum++;
}
int main()
{
int i,k;
scanf("%d %d", &n,&k);
for (i=0; i<n; i++)
{
scanf("%d",&ar[i]);
}
for (int i=0; ; i++)
{
m=m+ar[i];
if (m==15) sum++;
else if (m>k)
}
m=0;
for (int i=0; ; i--)
{
m=m+ar[i];
if (m==15) sum++;
else if (m>k)
}
}
*/
/*
#include <stdio.h>
int a[100000]={};
void swap(int x, int y)
{
int t=a[x]; a[x]=a[y]; a[y]=t;
}
//quick-sort
void qs(int s, int e)
{
int p=s,low=s,high=e+1;
if(s>=e) return ;
do
{
do
{
low++;
}while(a[low]<a[p]);
do
{
high--;
}while(a[high]>a[p]);
//a[low] a[p]보다 큰값
//a[high] a[p]보다 작은값
if(low<high) swap(low,high);
}while(low<high);
swap(high,p);
qs(s,high-1);
qs(high+1,e);
}
#include <stdio.h>
int a[100000]={};
void swap(int x, int y)
{
int t=a[x]; a[x]=a[y]; a[y]=t;
}
//quick-sort
void qs(int s, int e)
{
int p=s,low=s,high=e+1;
if(s>=e) return ;
do
{
do
{
low++;
}while(a[low]<a[p]);
//a[low]가 기준값보다 크다.
do
{
high--;
}while(a[high]>a[p]);
//a[high]가 기준값보다 작다.
if(low<high) swap(low,high);
//작은값이 오른쪽에 있고, 큰값이 왼쪽에 있으니까 둘이 자리를 바꿔라
}while(low<high);
//a[p]룰 기준으로 작은값은 모두 왼쪽에, 큰값은 모두 오른쪽에 배치완료.
swap(high,p); //기준값을 가운데로 옮겨놓고
qs(s,high-1);//기준값 왼쪽 정렬해라
qs(high+1,e); //기준값 오른쪽 정렬해라
}
int main()
{
int n,i;
scanf("%d",&n);
for (i=0; i<n; i++)
{
scanf("%d",&a[i]);
}qs(0,n-1);
for (i=0; i<n; i++)
{
printf("%d\n",a[i]);
}
}
*/
#include <stdio.h>
int a[50000]={};
int bs(int s, int e, int k)
{
int mid=(s+e)/2;
if(s>e) return -1;
if(a[mid]==k) return mid;
else if(a[mid]<k) bs(mid+1,e,k);
else bs(s,mid-1,k);
}
void swap(int x, int y)
{
int t=a[x]; a[x]=a[y]; a[y]=t;
}
//quick-sort
void qs(int s, int e)
{
int p=s,low=s,high=e+1;
if(s>=e) return ;
do
{
do
{
low++;
}while(a[low]<a[p]);
//a[low]가 기준값보다 크다.
do
{
high--;
}while(a[high]>a[p]);
//a[high]가 기준값보다 작다.
if(low<high) swap(low,high);
//작은값이 오른쪽에 있고, 큰값이 왼쪽에 있으니까 둘이 자리를 바꿔라
}while(low<high);
//a[p]룰 기준으로 작은값은 모두 왼쪽에, 큰값은 모두 오른쪽에 배치완료.
swap(high,p); //기준값을 가운데로 옮겨놓고
qs(s,high-1);//기준값 왼쪽 정렬해라
qs(high+1,e); //기준값 오른쪽 정렬해라
}
int main()
{
int n,i,j,tmp;
int br[50000]={};
scanf("%d",&n);
for (i=0; i<n; i++)
{
scanf("%d",&a[i]);
br[i]=a[i];
}
qs(0,n-1);
for (i=0; i<n; i++)
{
printf("%d ",bs(0,n-1,br[i]));
}
}