n=io.read("*n")
a={}
for i=1, n do
    a[i]=io.read("*n")
end

b={}
for i=1, n do
    if b[a[i]]==nil then
        b[a[i]]=1
    else
        b[a[i]]=b[a[i]]+1
    end
end

total=0
for key,value in pairs(b) do
    total=total+value*(value-1)//2
end

for i=1, n do
    answer = total
    answer = answer - (b[a[i]]*(b[a[i]]-1)//2)
    answer = answer + ((b[a[i]]-1)*(b[a[i]]-2)//2)
    print(answer)
end