def main():



    from collections import Counter

    import sys



    n = int(eval(input()))

    a = list(map(int, sys.stdin.readline().split()))



    d = Counter(a)



    base = sum(v * (v - 1) // 2 for v in list(d.values()))

    e = {k: base - (v >= 2) * (v - 1) for k, v in list(d.items())}

    for i in a:

        print((e[i]))





if __name__ == '__main__':

    main()

def main():

    from collections import Counter

    import sys



    eval(input())

    a = list(map(int, sys.stdin.readline().split()))



    d = Counter(a)



    base = sum(v * (v - 1) // 2 for v in list(d.values()))

    e = [str(base - (d[v] - 1)) for v in a]

    print(('\n'.join(e)))





if __name__ == '__main__':

    main()

def main():
    from collections import Counter
    import sys

    n = int(eval(input()))
    a = list(map(int, sys.stdin.readline().split()))
    d = Counter(a)
    base = sum(v * (v - 1) // 2 for v in list(d.values()))
    e = {k: base - (v >= 2) * (v - 1) for k, v in list(d.items())}
    for i in a:
        print((e[i]))


if __name__ == "__main__":
    main()

def main():
    from collections import Counter
    import sys

    eval(input())
    a = list(map(int, sys.stdin.readline().split()))
    d = Counter(a)
    base = sum(v * (v - 1) // 2 for v in list(d.values()))
    e = [str(base - (d[v] - 1)) for v in a]
    print(("\n".join(e)))


if __name__ == "__main__":
    main()

-    n = int(eval(input())) +    eval(input()) -    e = {k: base - (v >= 2) * (v - 1) for k, v in list(d.items())} -    for i in a: -        print((e[i])) +    e = [str(base - (d[v] - 1)) for v in a] +    print(("\n".join(e)))