def solve(string):
    _, *l = map(int, string.split())
    l.sort()
    ans = 0
    for i, l0 in enumerate(l[:-2]):
        for j, l1 in enumerate(l[i + 1:-1]):
            if l0 == l1:
                continue
            for l2 in l[i + j + 2:]:
                if l1 == l2:
                    continue
                if l2 < l0 + l1:
                    ans += 1
                else:
                    break
    return str(ans)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip())) def solve(string):
    _, *l = map(int, string.split())
    l.sort()
    ans = 0
    for i, l0 in enumerate(l[:-2]):
        for j, l1 in enumerate(l[i + 1:-1]):
            if l0 == l1:
                continue
            for l2 in l[i + j + 2:]:
                if l1 == l2:
                    continue
                if l2 < l0 + l1:
                    ans += 1
                else:
                    break
    return str(ans) solve _, *l = map(int, string.split()) _ map(int, string.split()) map int string.split() string.split string split *l l l.sort() l.sort l sort ans = 0 ans 0 for i, l0 in enumerate(l[:-2]):
        for j, l1 in enumerate(l[i + 1:-1]):
            if l0 == l1:
                continue
            for l2 in l[i + j + 2:]:
                if l1 == l2:
                    continue
                if l2 < l0 + l1:
                    ans += 1
                else:
                    break
     i l0 enumerate(l[:-2]) enumerate l[:-2] l :-2 -2 for j, l1 in enumerate(l[i + 1:-1]):
            if l0 == l1:
                continue
            for l2 in l[i + j + 2:]:
                if l1 == l2:
                    continue
                if l2 < l0 + l1:
                    ans += 1
                else:
                    break
     j l1 enumerate(l[i + 1:-1]) enumerate l[i + 1:-1] l i + 1:-1 i + 1 i 1 -1 if l0 == l1:
                continue
             l0 == l1 l0 l1 continue for l2 in l[i + j + 2:]:
                if l1 == l2:
                    continue
                if l2 < l0 + l1:
                    ans += 1
                else:
                    break
     l2 l[i + j + 2:] l i + j + 2: i + j + 2 i + j i j 2 if l1 == l2:
                    continue
                 l1 == l2 l1 l2 continue if l2 < l0 + l1:
                    ans += 1
                else:
                    break
     l2 < l0 + l1 l2 l0 + l1 l0 l1 ans += 1 ans 1 break return str(ans) str(ans) str ans string string if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip())) __name__ == '__main__' __name__ '__main__' import sys sys print(solve(sys.stdin.read().strip())) print solve(sys.stdin.read().strip()) solve sys.stdin.read().strip() sys.stdin.read().strip sys.stdin.read() sys.stdin.read sys.stdin sys stdin read strip def solve(string):
    _, *l = map(int, string.split())
    l.sort()
    ans = 0
    for i, l0 in enumerate(l[:-2]):
        for j, l1 in enumerate(l[i + 1:-1]):
            if l0 == l1:
                continue
            for l2 in l[i + j + 2:]:
                if l1 == l2:
                    continue
                if l2 < l0 + l1:
                    ans += 1
                else:
                    break
    return str(ans) def solve(string):
    _, *l = map(int, string.split())
    l.sort()
    ans = 0
    for i, l0 in enumerate(l[:-2]):
        for j, l1 in enumerate(l[i + 1:-1]):
            if l0 == l1:
                continue
            for l2 in l[i + j + 2:]:
                if l1 == l2:
                    continue
                if l2 < l0 + l1:
                    ans += 1
                else:
                    break
    return str(ans) solve
def solve(string):
    _, *l = map(int, string.split())
    l.sort()
    ans = 0
    for i, l0 in enumerate(l[:-2]):
        for j, l1 in enumerate(l[i + 1:-1]):
            if l0 == l1:
                continue
            for l2 in l[i + j + 2:]:
                if l1 == l2:
                    continue
                if l2 < l0 + l1:
                    ans += 1
                else:
                    break
    return str(ans)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
