import itertools

n = int(input())
arr = list(map(int, input().split()))
arr.sort()
count = 0
for i in itertools.combinations(arr, 3):
    if i[0] + i[1] > i[2] and i[0] + i[2] > i[1] and i[2] + i[1] > i[0] and i[0] != i[1] != i[2]:
        count += 1
print(count)

 import itertools itertools n = int(input()) n int(input()) int input() input arr = list(map(int, input().split())) arr list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split arr.sort() arr.sort arr sort count = 0 count 0 for i in itertools.combinations(arr, 3):
    if i[0] + i[1] > i[2] and i[0] + i[2] > i[1] and i[2] + i[1] > i[0] and i[0] != i[1] != i[2]:
        count += 1 i itertools.combinations(arr, 3) itertools.combinations itertools combinations arr 3 if i[0] + i[1] > i[2] and i[0] + i[2] > i[1] and i[2] + i[1] > i[0] and i[0] != i[1] != i[2]:
        count += 1 i[0] + i[1] > i[2] and i[0] + i[2] > i[1] and i[2] + i[1] > i[0] and i[0] != i[1] != i[2] i[0] + i[1] > i[2] and i[0] + i[2] > i[1] and i[2] + i[1] > i[0] i[0] + i[1] > i[2] and i[0] + i[2] > i[1] i[0] + i[1] > i[2] i[0] + i[1] i[0] i 0 i[1] i 1 i[2] i 2 i[0] + i[2] > i[1] i[0] + i[2] i[0] i 0 i[2] i 2 i[1] i 1 i[2] + i[1] > i[0] i[2] + i[1] i[2] i 2 i[1] i 1 i[0] i 0 i[0] != i[1] != i[2] i[0] != i[1] i[0] i 0 i[1] i 1 i[2] i 2 count += 1 count 1 print(count) print count arr = list(map(int, input().split())) list(map(int, input().split())) arr count += 1 1 count n = int(input()) int(input()) n count = 0 0 count
import itertools

n = int(input())
arr = list(map(int, input().split()))
arr.sort()
count = 0
for i in itertools.combinations(arr, 3):
    if i[0] + i[1] > i[2] and i[0] + i[2] > i[1] and i[2] + i[1] > i[0] and i[0] != i[1] != i[2]:
        count += 1
print(count)


