from numba import jit



@jit

def abc175_b():

    n = int(eval(input()))

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

    cnt = 0



    for i in range(0, n - 2):

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

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



                # 辺の長さが同じ場合は却下

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

                    continue

                # 三角形になるにはa+b>c,b+c>a,c+a>b

                if (l[i] + l[j] > l[k]) and (l[j] + l[k] > l[i]) and (l[k] + l[i] > l[j]):

                    cnt += 1

    print(cnt)



if __name__ == '__main__':

    abc175_b()
def abc175_b():

    n = int(eval(input()))

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

    cnt = 0



    for i in range(0, n - 2):

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

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



                # 辺の長さが同じ場合は却下

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

                    continue

                # 三角形になるにはa+b>c,b+c>a,c+a>b

                if (l[i] + l[j] > l[k]) and (l[j] + l[k] > l[i]) and (l[k] + l[i] > l[j]):

                    cnt += 1

    print(cnt)



if __name__ == '__main__':

    abc175_b()
from numba import jit


@jit
def abc175_b():
    n = int(eval(input()))
    l = list(map(int, input().split(" ")))
    cnt = 0
    for i in range(0, n - 2):
        for j in range(i + 1, n):
            for k in range(j + 1, n):
                # 辺の長さが同じ場合は却下
                if l[i] == l[j] or l[j] == l[k] or l[k] == l[i]:
                    continue
                # 三角形になるにはa+b>c,b+c>a,c+a>b
                if (
                    (l[i] + l[j] > l[k])
                    and (l[j] + l[k] > l[i])
                    and (l[k] + l[i] > l[j])
                ):
                    cnt += 1
    print(cnt)


if __name__ == "__main__":
    abc175_b()

def abc175_b():
    n = int(eval(input()))
    l = list(map(int, input().split(" ")))
    cnt = 0
    for i in range(0, n - 2):
        for j in range(i + 1, n - 1):
            for k in range(j + 1, n):
                # 辺の長さが同じ場合は却下
                if l[i] == l[j] or l[j] == l[k] or l[k] == l[i]:
                    continue
                # 三角形になるにはa+b>c,b+c>a,c+a>b
                if (
                    (l[i] + l[j] > l[k])
                    and (l[j] + l[k] > l[i])
                    and (l[k] + l[i] > l[j])
                ):
                    cnt += 1
    print(cnt)


if __name__ == "__main__":
    abc175_b()

-from numba import jit - - -@jit -        for j in range(i + 1, n): +        for j in range(i + 1, n - 1):