from bisect import bisect_left, bisect_right

n = int(eval(input()))

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

l.sort()



ans = 0

for i in range(n):

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

        if l[i] == l[j]:

            continue



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

            if l[i] == l[k] or l[j] == l[k]:

                continue

            if l[i] + l[j] > l[k]:

                ans += 1



print(ans)

from bisect import bisect_left, bisect_right

n = int(eval(input()))

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

l.sort()



ans = 0

for j in range(n):

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

        if l[j] == l[k]:

            continue



        ans += max(bisect_left(l, l[j]) - bisect_right(l, l[k] - l[j]), 0)



print(ans)

from bisect import bisect_left, bisect_right

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

from bisect import bisect_left, bisect_right

n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
ans = 0
for j in range(n):
    for k in range(j + 1, n):
        if l[j] == l[k]:
            continue
        ans += max(bisect_left(l, l[j]) - bisect_right(l, l[k] - l[j]), 0)
print(ans)

-for i in range(n): -    for j in range(i + 1, n): -        if l[i] == l[j]: +for j in range(n): +    for k in range(j + 1, n): +        if l[j] == l[k]: -        for k in range(j + 1, n): -            if l[i] == l[k] or l[j] == l[k]: -                continue -            if l[i] + l[j] > l[k]: -                ans += 1 +        ans += max(bisect_left(l, l[j]) - bisect_right(l, l[k] - l[j]), 0)