n = int(eval(input()))

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



ans = 0

for i in range(n-2):

  for j in range(i+1, n-1):

    for k in range(j+1, n):

      if l[i] != l[j] and l[i] != l[k] and l[j] != l[k]:

        if l[i]+l[j] > l[k] and l[i]+l[k] > l[j] and l[j]+l[k] > l[i]: ans += 1

print(ans)
from itertools import combinations

n = int(eval(input()))

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



ans = 0

for i,j,k in combinations(l,3):

  if i == j or i == k or j == k: continue

  if i >= j+k or j >= i+k or k >= i+j: continue

  ans += 1

print(ans)
n = int(eval(input()))
l = list(map(int, input().split()))
ans = 0
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        for k in range(j + 1, n):
            if l[i] != l[j] and l[i] != l[k] and l[j] != l[k]:
                if l[i] + l[j] > l[k] and l[i] + l[k] > l[j] and l[j] + l[k] > l[i]:
                    ans += 1
print(ans)

from itertools import combinations

n = int(eval(input()))
l = list(map(int, input().split()))
ans = 0
for i, j, k in combinations(l, 3):
    if i == j or i == k or j == k:
        continue
    if i >= j + k or j >= i + k or k >= i + j:
        continue
    ans += 1
print(ans)

+from itertools import combinations + -for i in range(n - 2): -    for j in range(i + 1, n - 1): -        for k in range(j + 1, n): -            if l[i] != l[j] and l[i] != l[k] and l[j] != l[k]: -                if l[i] + l[j] > l[k] and l[i] + l[k] > l[j] and l[j] + l[k] > l[i]: -                    ans += 1 +for i, j, k in combinations(l, 3): +    if i == j or i == k or j == k: +        continue +    if i >= j + k or j >= i + k or k >= i + j: +        continue +    ans += 1