import sys

read = sys.stdin.read

readlines = sys.stdin.readlines

from itertools import combinations

def main():

    n, *l = list(map(int, read().split()))

    if n < 3:

        print((0))

        sys.exit()

    com = tuple(combinations(l, 3))

    r = 0

    for c in com:

        c1 = c[0]

        c2 = c[1]

        c3 = c[2]

        if c1 == c2 or c2 == c3 or c1 == c3:

            continue

        else:

            cs = sum(c) - max(c)

            r += cs > max(c)



    print(r)

if __name__ == '__main__':

    main()
import sys

read = sys.stdin.read

readlines = sys.stdin.readlines

from itertools import combinations

def main():

    n, *a = list(map(int, read().split()))

    coma = combinations(a, 3)

    r = 0

    for c in coma:

        if sum(c) > max(c)*2:

            if len(set(c)) > 2:

                r += 1

    print(r)



if __name__ == '__main__':

    main()

import sys

read = sys.stdin.read
readlines = sys.stdin.readlines
from itertools import combinations


def main():
    n, *l = list(map(int, read().split()))
    if n < 3:
        print((0))
        sys.exit()
    com = tuple(combinations(l, 3))
    r = 0
    for c in com:
        c1 = c[0]
        c2 = c[1]
        c3 = c[2]
        if c1 == c2 or c2 == c3 or c1 == c3:
            continue
        else:
            cs = sum(c) - max(c)
            r += cs > max(c)
    print(r)


if __name__ == "__main__":
    main()

import sys

read = sys.stdin.read
readlines = sys.stdin.readlines
from itertools import combinations


def main():
    n, *a = list(map(int, read().split()))
    coma = combinations(a, 3)
    r = 0
    for c in coma:
        if sum(c) > max(c) * 2:
            if len(set(c)) > 2:
                r += 1
    print(r)


if __name__ == "__main__":
    main()

-    n, *l = list(map(int, read().split())) -    if n < 3: -        print((0)) -        sys.exit() -    com = tuple(combinations(l, 3)) +    n, *a = list(map(int, read().split())) +    coma = combinations(a, 3) -    for c in com: -        c1 = c[0] -        c2 = c[1] -        c3 = c[2] -        if c1 == c2 or c2 == c3 or c1 == c3: -            continue -        else: -            cs = sum(c) - max(c) -            r += cs > max(c) +    for c in coma: +        if sum(c) > max(c) * 2: +            if len(set(c)) > 2: +                r += 1