N = int(input())
A = list(map(int,input().split()))
answer = 0
for i in range(len(A)) :
    for j in range(i+1,len(A)) :
        p = 0
        p += A[j]
        if A[i] == A[j] :
            answer += 1
print(answer)

