N = int(input()) A = [int(i)-1 for i in input().split()] #s = [[int(j) for j in input().split()] for i in range(N)] d = dict([(i,0) for i in range(100)]) for a in A: d[a]+=1 res = 0 for i in range(100): for j in range(i+1,100): for k in range(j+1,100): res += d[i] * d[j] * d[k] print(res)