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

local two_or_mores = {}
for same_num = 1, n do
    local same_num_amount = 0
    for i = 1, n do
        if a[i] == same_num then
            same_num_amount = same_num_amount + 1
        end
    end
    if same_num_amount >= 2 then
        table.insert(two_or_mores, {same_num, same_num_amount})
    end
end

-- 一つだけのとき 特定の値を出力
local only_one_out = 0
for i = 1, #two_or_mores do
    only_one_out = only_one_out + two_or_mores[i][2] * (two_or_mores[i][2] - 1) / 2
end
-- same_numのとき その値一つ抜いた値を出力
local t_o_m_out = {}
for i = 1, #two_or_mores do
    local same_num = two_or_mores[i][1]
    t_o_m_out[same_num] = 0
    for j = 1, #two_or_mores do
        if j == i then
            if two_or_mores[j][2] >= 2 then
                t_o_m_out[same_num] = t_o_m_out[same_num] + (two_or_mores[j][2] - 1) * (two_or_mores[j][2] - 2) / 2
            end
        else
            t_o_m_out[same_num] = t_o_m_out[same_num] + two_or_mores[j][2] * (two_or_mores[j][2] - 1) / 2
        end
    end
end
local outs = {}
for i = 1, n do
    if t_o_m_out[a[i]] then
        outs[i] = t_o_m_out[a[i]]
    else
        outs[i] = only_one_out
    end
end
print(table.concat(outs, "\n"))