from itertools import combinations

def main():
    _ = int(input())
    A = list(map(int, input().split()))
    if len(set(A)) < 3:
        print(0)
        return
    C = combinations(A, 3)
    ans = 0
    for c in C:
        c = sorted(c)
        if c[0] != c[1] and c[0] != c[1] and c[1] != c[2]:
            if c[2] < c[1] + c[0]:
                ans += 1
    print(ans)
    
    
if __name__ == '__main__':
    main() from itertools import combinations def main():
    _ = int(input())
    A = list(map(int, input().split()))
    if len(set(A)) < 3:
        print(0)
        return
    C = combinations(A, 3)
    ans = 0
    for c in C:
        c = sorted(c)
        if c[0] != c[1] and c[0] != c[1] and c[1] != c[2]:
            if c[2] < c[1] + c[0]:
                ans += 1
    print(ans)
    
     main _ = int(input()) _ int(input()) int input() input A = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split if len(set(A)) < 3:
        print(0)
        return
     len(set(A)) < 3 len(set(A)) len set(A) set A 3 print(0) print 0 return C = combinations(A, 3) C combinations(A, 3) combinations A 3 ans = 0 ans 0 for c in C:
        c = sorted(c)
        if c[0] != c[1] and c[0] != c[1] and c[1] != c[2]:
            if c[2] < c[1] + c[0]:
                ans += 1
     c C c = sorted(c) c sorted(c) sorted c if c[0] != c[1] and c[0] != c[1] and c[1] != c[2]:
            if c[2] < c[1] + c[0]:
                ans += 1
     c[0] != c[1] and c[0] != c[1] and c[1] != c[2] c[0] != c[1] and c[0] != c[1] c[0] != c[1] c[0] c 0 c[1] c 1 c[0] != c[1] c[0] c 0 c[1] c 1 c[1] != c[2] c[1] c 1 c[2] c 2 if c[2] < c[1] + c[0]:
                ans += 1
     c[2] < c[1] + c[0] c[2] c 2 c[1] + c[0] c[1] c 1 c[0] c 0 ans += 1 ans 1 print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    _ = int(input())
    A = list(map(int, input().split()))
    if len(set(A)) < 3:
        print(0)
        return
    C = combinations(A, 3)
    ans = 0
    for c in C:
        c = sorted(c)
        if c[0] != c[1] and c[0] != c[1] and c[1] != c[2]:
            if c[2] < c[1] + c[0]:
                ans += 1
    print(ans)
    
     def main():
    _ = int(input())
    A = list(map(int, input().split()))
    if len(set(A)) < 3:
        print(0)
        return
    C = combinations(A, 3)
    ans = 0
    for c in C:
        c = sorted(c)
        if c[0] != c[1] and c[0] != c[1] and c[1] != c[2]:
            if c[2] < c[1] + c[0]:
                ans += 1
    print(ans)
    
     main
from itertools import combinations

def main():
    _ = int(input())
    A = list(map(int, input().split()))
    if len(set(A)) < 3:
        print(0)
        return
    C = combinations(A, 3)
    ans = 0
    for c in C:
        c = sorted(c)
        if c[0] != c[1] and c[0] != c[1] and c[1] != c[2]:
            if c[2] < c[1] + c[0]:
                ans += 1
    print(ans)
    
    
if __name__ == '__main__':
    main()