import itertools

def main(L):
    ans = 0
    for pair in itertools.combinations(L, 3):
        if len(set(pair)) < 3:
            continue
        lines = list(pair)
        a = max(lines)
        lines.remove(a)
        b, c = lines
        if a < b + c:
            ans += 1
    return ans

if __name__ == '__main__':
    N = int(input())
    L = list(map(int, input().split()))
    ans = main(L)
    print(ans)
 import itertools itertools def main(L):
    ans = 0
    for pair in itertools.combinations(L, 3):
        if len(set(pair)) < 3:
            continue
        lines = list(pair)
        a = max(lines)
        lines.remove(a)
        b, c = lines
        if a < b + c:
            ans += 1
    return ans main ans = 0 ans 0 for pair in itertools.combinations(L, 3):
        if len(set(pair)) < 3:
            continue
        lines = list(pair)
        a = max(lines)
        lines.remove(a)
        b, c = lines
        if a < b + c:
            ans += 1
     pair itertools.combinations(L, 3) itertools.combinations itertools combinations L 3 if len(set(pair)) < 3:
            continue
         len(set(pair)) < 3 len(set(pair)) len set(pair) set pair 3 continue lines = list(pair) lines list(pair) list pair a = max(lines) a max(lines) max lines lines.remove(a) lines.remove lines remove a b, c = lines b lines c if a < b + c:
            ans += 1
     a < b + c a b + c b c ans += 1 ans 1 return ans ans L L if __name__ == '__main__':
    N = int(input())
    L = list(map(int, input().split()))
    ans = main(L)
    print(ans) __name__ == '__main__' __name__ '__main__' N = int(input()) N int(input()) int input() input L = list(map(int, input().split())) L list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ans = main(L) ans main(L) main L print(ans) print ans N = int(input()) int(input()) N ans = main(L) main(L) ans L = list(map(int, input().split())) list(map(int, input().split())) L def main(L):
    ans = 0
    for pair in itertools.combinations(L, 3):
        if len(set(pair)) < 3:
            continue
        lines = list(pair)
        a = max(lines)
        lines.remove(a)
        b, c = lines
        if a < b + c:
            ans += 1
    return ans def main(L):
    ans = 0
    for pair in itertools.combinations(L, 3):
        if len(set(pair)) < 3:
            continue
        lines = list(pair)
        a = max(lines)
        lines.remove(a)
        b, c = lines
        if a < b + c:
            ans += 1
    return ans main
import itertools

def main(L):
    ans = 0
    for pair in itertools.combinations(L, 3):
        if len(set(pair)) < 3:
            continue
        lines = list(pair)
        a = max(lines)
        lines.remove(a)
        b, c = lines
        if a < b + c:
            ans += 1
    return ans

if __name__ == '__main__':
    N = int(input())
    L = list(map(int, input().split()))
    ans = main(L)
    print(ans)

