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

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