n=int(eval(input()))

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



ans_l=[0]*(n+1)

ans=0

def con(a):

    return int(a*(a-1)*0.5)

for i in range(n):

    ans_l[l[i]]+=1

#print("ans_l",ans_l)

#print("l",l)

for j in ans_l:

    ans+=con(j)

# print(ans)

for i in range(n):

    ans_2=ans

    # print("ans_2_0:",ans_2)

    #print("ans_l[l[i]]",ans_l[l[i]])

    ans_2-=con(ans_l[l[i]])

    #print("ans_2_1:",ans_2)

    

    #print("ans_l[l[i]]:",ans_l[l[i]]-1)

    ans_2+=con(ans_l[l[i]]-1)

    print(ans_2)

n=int(eval(input()))

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



ans_l=[0]*(n+1)

ans=0

def con(a):

    return int(a*(a-1)*0.5)

for i in l:

    ans_l[i]+=1

#print("ans_l",ans_l)

#print("l",l)

for j in ans_l:

    ans+=con(j)

# print(ans)

for i in l:

    ans_2=ans

    # print("ans_2_0:",ans_2)

    #print("ans_l[i]",ans_l[i])

    ans_2-=con(ans_l[i])

    #print("ans_2_1:",ans_2)

    

    #print("ans_l[i]:",ans_l[i]-1)   

    ans_2+=con(ans_l[i]-1)

    print(ans_2)
n = int(eval(input()))
l = list(map(int, input().split()))
ans_l = [0] * (n + 1)
ans = 0


def con(a):
    return int(a * (a - 1) * 0.5)


for i in range(n):
    ans_l[l[i]] += 1
# print("ans_l",ans_l)
# print("l",l)
for j in ans_l:
    ans += con(j)
# print(ans)
for i in range(n):
    ans_2 = ans
    # print("ans_2_0:",ans_2)
    # print("ans_l[l[i]]",ans_l[l[i]])
    ans_2 -= con(ans_l[l[i]])
    # print("ans_2_1:",ans_2)
    # print("ans_l[l[i]]:",ans_l[l[i]]-1)
    ans_2 += con(ans_l[l[i]] - 1)
    print(ans_2)

n = int(eval(input()))
l = list(map(int, input().split()))
ans_l = [0] * (n + 1)
ans = 0


def con(a):
    return int(a * (a - 1) * 0.5)


for i in l:
    ans_l[i] += 1
# print("ans_l",ans_l)
# print("l",l)
for j in ans_l:
    ans += con(j)
# print(ans)
for i in l:
    ans_2 = ans
    # print("ans_2_0:",ans_2)
    # print("ans_l[i]",ans_l[i])
    ans_2 -= con(ans_l[i])
    # print("ans_2_1:",ans_2)
    # print("ans_l[i]:",ans_l[i]-1)
    ans_2 += con(ans_l[i] - 1)
    print(ans_2)

-for i in range(n): -    ans_l[l[i]] += 1 +for i in l: +    ans_l[i] += 1 -for i in range(n): +for i in l: -    # print("ans_l[l[i]]",ans_l[l[i]]) -    ans_2 -= con(ans_l[l[i]]) +    # print("ans_l[i]",ans_l[i]) +    ans_2 -= con(ans_l[i]) -    # print("ans_l[l[i]]:",ans_l[l[i]]-1) -    ans_2 += con(ans_l[l[i]] - 1) +    # print("ans_l[i]:",ans_l[i]-1) +    ans_2 += con(ans_l[i] - 1)