import std.conv, std.stdio;
import std.algorithm, std.array, std.string, std.range;
void main()
{
    readln;
    auto a = readln.chomp.split.to!(int[]);
    "%(%d\n%)".writefln(a.solve);
}
ulong[] solve(in int[] a)
{
    size_t[int] d;
    foreach (x; a)
        if (auto p = x in d)
            (*p)++;
        else
            d[x] = 1;
    auto s = d.byValue.map!(c => c * (c - 1) / 2).sum;
    ulong[] ret;
    foreach (x; a)
        ret ~= s - (d[x] - 1);
    return ret;
}
