#include<iostream>
using namespace std;

int main()
{
    int n, a[4001], b[4001];
    double* d;

    cin >> n;

    d = new double[n];

    for( int i = 0; i < 4001; i++ )
    {
        a[i] = 0;
        b[i] = 0;
    }

    for( int i = 0; i < n; i++ )
    {
        cin >> d[i];
        int c = (int)( 1000 * ( d[i] + 0.0004 ) );
        a[c]++;
    }

    for( int i = 1; i < 4001; i++ )
        b[i] = b[i-1] + a[i-1];

    for( int i = 0; i < 4001; i++ )
    {
        if( a[i] > 1 )
            b[i] = a[i] - 1 + b[i] * 3;
        else
            b[i] = b[i] * 3;
    }

    for( int i = 0; i < n; i++ )
        cout << b[(int)(1000*(d[i]+0.0004))] << endl;

    delete d;
    return 0;
}
