def main():

    from collections import defaultdict

    from collections import Counter

    import sys



    n = int(eval(input()))

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



    d = Counter(a)

    e = defaultdict(int)



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



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

        if v <= 1:

            e[k] = base - 0

        else:

            e[k] = base - (v - 1)



    p = [str(e[x]) + '\n' for x in a]

    q = ''.join(p)

    print(q)





if __name__ == '__main__':

    main()

def main():

    from collections import defaultdict

    from collections import Counter

    import sys



    n = int(eval(input()))

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



    d = Counter(a)

    e = defaultdict(int)



    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())}



    p = [str(e[x]) + '\n' for x in a]

    q = ''.join(p)

    print(q)





if __name__ == '__main__':

    main()

def main():
    from collections import defaultdict
    from collections import Counter
    import sys

    n = int(eval(input()))
    a = list(map(int, sys.stdin.readline().split()))
    d = Counter(a)
    e = defaultdict(int)
    base = sum(v * (v - 1) // 2 for v in list(d.values()))
    for k, v in list(d.items()):
        if v <= 1:
            e[k] = base - 0
        else:
            e[k] = base - (v - 1)
    p = [str(e[x]) + "\n" for x in a]
    q = "".join(p)
    print(q)


if __name__ == "__main__":
    main()

def main():
    from collections import defaultdict
    from collections import Counter
    import sys

    n = int(eval(input()))
    a = list(map(int, sys.stdin.readline().split()))
    d = Counter(a)
    e = defaultdict(int)
    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())}
    p = [str(e[x]) + "\n" for x in a]
    q = "".join(p)
    print(q)


if __name__ == "__main__":
    main()

-    for k, v in list(d.items()): -        if v <= 1: -            e[k] = base - 0 -        else: -            e[k] = base - (v - 1) +    e = {k: base - (v >= 2) * (v - 1) for k, v in list(d.items())}