
#include<bits/stdc++.h>
using namespace std;

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}


signed main(){
    int N;
    cin>>N;
    vector<double>a(N);
    rep(i,N)cin>>a[i];
    map<double,int>cnt;
    rep(i,N)cnt[a[i]]++;

    map<double,int>ans;
    int sum=0;
    for(auto &w:cnt){
        ans[w.fi]=sum*3+w.se-1;
        sum+=w.se;
    }

    rep(i,N)cout<<ans[a[i]]<<endl;
    return 0;
}