n=int(eval(input()))



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



memo = [0]*(2*(10**5)+1)



for i in t:

    memo[i]+=1



sumv=0



for j in memo:

    sumv+=j*(j-1)//2



for i in t:

    print((sumv-(memo[i]*(memo[i]-1))//2+((memo[i]-2)*(memo[i]-1)//2)))

n=int(eval(input()))



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



memo = [0]*(2*10**5+1)



for i in t:

    memo[i] += 1



ans = 0



for i in memo:

    ans += i*(i-1)//2



for i in t:

    print((ans-(memo[i]*(memo[i]-1)//2)+((memo[i]-1)*(memo[i]-2)//2)))

    

n = int(eval(input()))
t = list(map(int, input().split()))
memo = [0] * (2 * (10**5) + 1)
for i in t:
    memo[i] += 1
sumv = 0
for j in memo:
    sumv += j * (j - 1) // 2
for i in t:
    print(
        (sumv - (memo[i] * (memo[i] - 1)) // 2 + ((memo[i] - 2) * (memo[i] - 1) // 2))
    )

n = int(eval(input()))
t = list(map(int, input().split()))
memo = [0] * (2 * 10**5 + 1)
for i in t:
    memo[i] += 1
ans = 0
for i in memo:
    ans += i * (i - 1) // 2
for i in t:
    print((ans - (memo[i] * (memo[i] - 1) // 2) + ((memo[i] - 1) * (memo[i] - 2) // 2)))

-memo = [0] * (2 * (10**5) + 1) +memo = [0] * (2 * 10**5 + 1) -sumv = 0 -for j in memo: -    sumv += j * (j - 1) // 2 +ans = 0 +for i in memo: +    ans += i * (i - 1) // 2 -    print( -        (sumv - (memo[i] * (memo[i] - 1)) // 2 + ((memo[i] - 2) * (memo[i] - 1) // 2)) -    ) +    print((ans - (memo[i] * (memo[i] - 1) // 2) + ((memo[i] - 1) * (memo[i] - 2) // 2)))