def combi(x):

    return x * (x-1) //2



n = int(eval(input()))

a = list(map(int,input().split()))



#print(a)    #思い出すときに使おう　動きが分かるよ



for i in range(len(a)):

    a[i] -= 1



#print(a)



cnt = [0] * n



for i in range(len(a)):

    cnt[a[i]] += 1



#print(cnt)



total = 0



for i in cnt:

    total += combi(i)



for i in range(n):

    ans = total

    ans -= combi(cnt[a[i]])

    ans += combi(cnt[a[i]]-1)

    print(ans)
def combi(x):

    return x * (x-1) //2



n = int(eval(input()))

a = list(map(int,input().split()))



#print(a)    #思い出すときに使おう　動きが分かるよ



for i in range(len(a)):

    a[i] -= 1



#print(a)



cnt = [0] * n



for i in range(len(a)):

    cnt[a[i]] += 1



#print(cnt)



total = 0



for i in cnt:

    total += combi(i)



for i in range(n):

    #ans = total

    #ans -= combi(cnt[a[i]])

    #ans += combi(cnt[a[i]]-1)

    ans = total - cnt[a[i]] + 1

    print(ans)
def combi(x):
    return x * (x - 1) // 2


n = int(eval(input()))
a = list(map(int, input().split()))
# print(a)    #思い出すときに使おう　動きが分かるよ
for i in range(len(a)):
    a[i] -= 1
# print(a)
cnt = [0] * n
for i in range(len(a)):
    cnt[a[i]] += 1
# print(cnt)
total = 0
for i in cnt:
    total += combi(i)
for i in range(n):
    ans = total
    ans -= combi(cnt[a[i]])
    ans += combi(cnt[a[i]] - 1)
    print(ans)

def combi(x):
    return x * (x - 1) // 2


n = int(eval(input()))
a = list(map(int, input().split()))
# print(a)    #思い出すときに使おう　動きが分かるよ
for i in range(len(a)):
    a[i] -= 1
# print(a)
cnt = [0] * n
for i in range(len(a)):
    cnt[a[i]] += 1
# print(cnt)
total = 0
for i in cnt:
    total += combi(i)
for i in range(n):
    # ans = total
    # ans -= combi(cnt[a[i]])
    # ans += combi(cnt[a[i]]-1)
    ans = total - cnt[a[i]] + 1
    print(ans)

-    ans = total -    ans -= combi(cnt[a[i]]) -    ans += combi(cnt[a[i]] - 1) +    # ans = total +    # ans -= combi(cnt[a[i]]) +    # ans += combi(cnt[a[i]]-1) +    ans = total - cnt[a[i]] + 1