N = int(eval(input()))

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

count,result={},{}



for i in range(N):

  count[a[i]]=0

  result[a[i]]=0

  

def ncn(n):

  return n*(n-1)//2



for i in range(N):

  count[a[i]]+=1



total=0

for key in list(count.keys()):

  kc = count[key]

  result[key]=ncn(kc)

  total += result[key]

  

def without(k):

  return total-count[a[k]] + 1



for k in range(N):

  print((without(k)))



N = int(eval(input()))

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

count={}



for i in range(N):

  count[a[i]]=0

  

def ncn(n):

  return n*(n-1)//2



for i in range(N):

  count[a[i]]+=1



total=0

for key in list(count.keys()):

  kc = count[key]

  total += ncn(kc)

  

def without(k):

  return total-count[a[k]] + 1



for k in range(N):

  print((without(k)))
N = int(eval(input()))
(*a,) = list(map(int, input().split()))
count, result = {}, {}
for i in range(N):
    count[a[i]] = 0
    result[a[i]] = 0


def ncn(n):
    return n * (n - 1) // 2


for i in range(N):
    count[a[i]] += 1
total = 0
for key in list(count.keys()):
    kc = count[key]
    result[key] = ncn(kc)
    total += result[key]


def without(k):
    return total - count[a[k]] + 1


for k in range(N):
    print((without(k)))

N = int(eval(input()))
(*a,) = list(map(int, input().split()))
count = {}
for i in range(N):
    count[a[i]] = 0


def ncn(n):
    return n * (n - 1) // 2


for i in range(N):
    count[a[i]] += 1
total = 0
for key in list(count.keys()):
    kc = count[key]
    total += ncn(kc)


def without(k):
    return total - count[a[k]] + 1


for k in range(N):
    print((without(k)))

-count, result = {}, {} +count = {} -    result[a[i]] = 0 -    result[key] = ncn(kc) -    total += result[key] +    total += ncn(kc)