import std.stdio,std.string,std.algorithm,std.conv;

void main(){
    readln;
    auto a=readln.chomp.split.to!(int[]);
    ulong[int] l;
    foreach(i;sort(a.dup).uniq){
        foreach(x;a)
            if(x==i)
                l[i]++;
    }   
    ulong sum;
    foreach(x;l.values)
        sum+=x*(x-1)>>1;
    foreach(x;a){
        (sum-(l[x]-1)).writeln;
    }   
}
