import sys

input = sys.stdin.readline

import itertools as it



def li():

    return [int(x) for x in input().split()]



N = int(eval(input()))

L = li()



# 組み合わせ列挙

c = it.combinations(L, 3)

c_list = list(c)



cnt = 0

for l in c_list:

    unique_l = len(set(l))

    if unique_l != 3:

        continue

    sum_l = l[0] + l[1] + l[2]

    max_l = max(l)

    sum_lest = sum_l - max_l

    if sum_lest > max_l:

        cnt += 1



print(cnt)
import sys

input = sys.stdin.readline

import itertools as it



def li():

    return [int(x) for x in input().split()]



N = int(eval(input()))

L = li()



# 組み合わせ列挙

com = it.combinations(L, 3)

com_list = list(com)



cnt = 0

for l in com_list:

    unique_l = len(set(l))

    if unique_l != 3:

        continue

    a, b, c = l[0], l[1], l[2]

    if a < b + c and b < c + a and c < a + b:

        cnt += 1



print(cnt)
import sys

input = sys.stdin.readline
import itertools as it


def li():
    return [int(x) for x in input().split()]


N = int(eval(input()))
L = li()
# 組み合わせ列挙
c = it.combinations(L, 3)
c_list = list(c)
cnt = 0
for l in c_list:
    unique_l = len(set(l))
    if unique_l != 3:
        continue
    sum_l = l[0] + l[1] + l[2]
    max_l = max(l)
    sum_lest = sum_l - max_l
    if sum_lest > max_l:
        cnt += 1
print(cnt)

import sys

input = sys.stdin.readline
import itertools as it


def li():
    return [int(x) for x in input().split()]


N = int(eval(input()))
L = li()
# 組み合わせ列挙
com = it.combinations(L, 3)
com_list = list(com)
cnt = 0
for l in com_list:
    unique_l = len(set(l))
    if unique_l != 3:
        continue
    a, b, c = l[0], l[1], l[2]
    if a < b + c and b < c + a and c < a + b:
        cnt += 1
print(cnt)

-c = it.combinations(L, 3) -c_list = list(c) +com = it.combinations(L, 3) +com_list = list(com) -for l in c_list: +for l in com_list: -    sum_l = l[0] + l[1] + l[2] -    max_l = max(l) -    sum_lest = sum_l - max_l -    if sum_lest > max_l: +    a, b, c = l[0], l[1], l[2] +    if a < b + c and b < c + a and c < a + b: