n = input() a = map(int, raw_input().split()) a.sort() num = [0] * 101 for x in a: num[x] += 1 s1, s2, s3 = 0, 0, 0 for x in num: s1 += x s2 += x * x s3 += x * x * x ans = (s1 ** 3 - s1 * s2 - 2 * s1 * s2 + 2 * s3) / 6 print ans