# Original solution
#!/usr/bin/env python

import sys
import argparse
import logging
#import math

logging.basicConfig(filename='logger.log', level=logging.DEBUG)
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)


def f(n: int, l_list: list, i: int = None, j: int = None, k: int = None) -> int:
    '''
    >>> f(0, [])
    0
    >>> f(1, [1])
    0
    >>> f(2, [1, 1])
    0
    >>> f(3, [1, 1, 1])
    0
    >>> f(3, [1, 1, 2])
    0
    >>> f(3, [1, 2, 2])
    0
    >>> f(3, [1, 2, 3])
    0
    >>> f(3, [1, 2, 4])
    0
    >>> f(3, [1, 3, 4])
    0
    >>> f(3, [2, 3, 4])
    1
    >>> f(5, [4, 4, 9, 7, 5])
    5
    >>> f(6, [4, 5, 4, 3, 3, 5])
    8
    >>> f(10, [9, 4, 6, 1, 9, 6, 10, 6, 6, 8])
    39
    '''
    if n <= 2:
        return 0
    result = 0
    for i in range(0, n-2):
        for j in range(i+1, n-1):
            for k in range(j+1, n):
                logger.debug("(n, i,j,k)=(%d, %d,%d,%d)" % (n, i, j, k))
                li = l_list[i]
                lj = l_list[j]
                lk = l_list[k]
                l_ijk = sorted([l_list[i], l_list[j], l_list[k]])
                if l_ijk[0] + l_ijk[1] > l_ijk[2]:
                    if li != lj and lj != lk and lk != li:
                        logger.debug("yes")
                        result += 1
    return result


if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument(
            '--doctest', action='store_true', default=False)
    args = parser.parse_args()
    if args.doctest:
        import doctest
        doctest.testmod(verbose=True)
        sys.exit()

    n = int(sys.stdin.readline().rstrip())
    l_list = list([int(x) for x in sys.stdin.readline().rstrip().split()])
    print((f(n, l_list)))

# Optimized solution
#!/usr/bin/env python

import sys
import argparse
import logging
#import math

logging.basicConfig(filename='logger.log', level=logging.DEBUG)
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)


def f(n: int, l_list: list, i: int = None, j: int = None, k: int = None) -> int:
    '''
    >>> f(0, [])
    0
    >>> f(1, [1])
    0
    >>> f(2, [1, 1])
    0
    >>> f(3, [1, 1, 1])
    0
    >>> f(3, [1, 1, 2])
    0
    >>> f(3, [1, 2, 2])
    0
    >>> f(3, [1, 2, 3])
    0
    >>> f(3, [1, 2, 4])
    0
    >>> f(3, [1, 3, 4])
    0
    >>> f(3, [2, 3, 4])
    1
    >>> f(5, [4, 4, 9, 7, 5])
    5
    >>> f(6, [4, 5, 4, 3, 3, 5])
    8
    >>> f(10, [9, 4, 6, 1, 9, 6, 10, 6, 6, 8])
    39
    '''
    if n <= 2:
        return 0
    result = 0
    for i in range(0, n-2):
        li = l_list[i]
        for j in range(i+1, n-1):
            lj = l_list[j]
            if li == lj:
                continue
            for k in range(j+1, n):
                lk = l_list[k]
                if li == lk or lj == lk:
                    continue
                #logger.debug("(n, i,j,k)=(%d, %d,%d,%d)" % (n, i, j, k))
                l_ijk = sorted([l_list[i], l_list[j], l_list[k]])
                if l_ijk[0] + l_ijk[1] > l_ijk[2]:
                    #logger.debug("yes")
                    result += 1
    return result


if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument(
            '--doctest', action='store_true', default=False)
    args = parser.parse_args()
    if args.doctest:
        import doctest
        doctest.testmod(verbose=True)
        sys.exit()

    n = int(sys.stdin.readline().rstrip())
    l_list = list([int(x) for x in sys.stdin.readline().rstrip().split()])
    print((f(n, l_list)))