# D - Banned K

from collections import Counter





def main():

    N, *A = list(map(int, open(0).read().split()))

    counter = Counter(A)

    total = 0

    dif = {}

    for k, v in list(counter.items()):

        total += max(0, v * (v - 1) // 2)

        dif[k] = max(0, v - 1)

    ans = [total - dif[a] for a in A]

    print(("\n".join(map(str, ans))))





if __name__ == "__main__":

    main()

# D - Banned K

from collections import Counter





def main():

    N, *A = list(map(int, open(0).read().split()))

    counter = Counter(A)

    total = 0

    dif = {}

    for k, v in list(counter.items()):

        total += v * (v - 1) // 2

        dif[k] = v - 1

    ans = [total - dif[a] for a in A]

    print(("\n".join(map(str, ans))))





if __name__ == "__main__":

    main()

# D - Banned K
from collections import Counter


def main():
    N, *A = list(map(int, open(0).read().split()))
    counter = Counter(A)
    total = 0
    dif = {}
    for k, v in list(counter.items()):
        total += max(0, v * (v - 1) // 2)
        dif[k] = max(0, v - 1)
    ans = [total - dif[a] for a in A]
    print(("\n".join(map(str, ans))))


if __name__ == "__main__":
    main()

# D - Banned K
from collections import Counter


def main():
    N, *A = list(map(int, open(0).read().split()))
    counter = Counter(A)
    total = 0
    dif = {}
    for k, v in list(counter.items()):
        total += v * (v - 1) // 2
        dif[k] = v - 1
    ans = [total - dif[a] for a in A]
    print(("\n".join(map(str, ans))))


if __name__ == "__main__":
    main()

-        total += max(0, v * (v - 1) // 2) -        dif[k] = max(0, v - 1) +        total += v * (v - 1) // 2 +        dif[k] = v - 1