def resolve():
    from itertools import combinations
    n = int(input())
    l = list(map(int, input().split()))
    ans = 0
    if n < 3:
        print(0)
        return

    for i in range(n):
        for j in range(n):
            for k in range(n):
                if i >= j or j >= k or i >= k:
                    continue
                if l[i] == l[j] or l[j] == l[k] or l[k] == l[i]:
                    continue
                if l[i] >= l[j] + l[k] or l[j] >= l[i] + l[k] or l[k] >= l[i] + l[j]:
                    continue
                ans += 1

    print(ans)

resolve() def resolve():
    from itertools import combinations
    n = int(input())
    l = list(map(int, input().split()))
    ans = 0
    if n < 3:
        print(0)
        return

    for i in range(n):
        for j in range(n):
            for k in range(n):
                if i >= j or j >= k or i >= k:
                    continue
                if l[i] == l[j] or l[j] == l[k] or l[k] == l[i]:
                    continue
                if l[i] >= l[j] + l[k] or l[j] >= l[i] + l[k] or l[k] >= l[i] + l[j]:
                    continue
                ans += 1

    print(ans) resolve from itertools import combinations 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 = 0 ans 0 if n < 3:
        print(0)
        return

     n < 3 n 3 print(0) print 0 return for i in range(n):
        for j in range(n):
            for k in range(n):
                if i >= j or j >= k or i >= k:
                    continue
                if l[i] == l[j] or l[j] == l[k] or l[k] == l[i]:
                    continue
                if l[i] >= l[j] + l[k] or l[j] >= l[i] + l[k] or l[k] >= l[i] + l[j]:
                    continue
                ans += 1

     i range(n) range n for j in range(n):
            for k in range(n):
                if i >= j or j >= k or i >= k:
                    continue
                if l[i] == l[j] or l[j] == l[k] or l[k] == l[i]:
                    continue
                if l[i] >= l[j] + l[k] or l[j] >= l[i] + l[k] or l[k] >= l[i] + l[j]:
                    continue
                ans += 1

     j range(n) range n for k in range(n):
                if i >= j or j >= k or i >= k:
                    continue
                if l[i] == l[j] or l[j] == l[k] or l[k] == l[i]:
                    continue
                if l[i] >= l[j] + l[k] or l[j] >= l[i] + l[k] or l[k] >= l[i] + l[j]:
                    continue
                ans += 1

     k range(n) range n if i >= j or j >= k or i >= k:
                    continue
                 i >= j or j >= k or i >= k i >= j or j >= k i >= j i j j >= k j k i >= k i k continue if l[i] == l[j] or l[j] == l[k] or l[k] == l[i]:
                    continue
                 l[i] == l[j] or l[j] == l[k] or l[k] == l[i] l[i] == l[j] or l[j] == l[k] l[i] == l[j] l[i] l i l[j] l j l[j] == l[k] l[j] l j l[k] l k l[k] == l[i] l[k] l k l[i] l i continue if l[i] >= l[j] + l[k] or l[j] >= l[i] + l[k] or l[k] >= l[i] + l[j]:
                    continue
                 l[i] >= l[j] + l[k] or l[j] >= l[i] + l[k] or l[k] >= l[i] + l[j] l[i] >= l[j] + l[k] or l[j] >= l[i] + l[k] l[i] >= l[j] + l[k] l[i] l i l[j] + l[k] l[j] l j l[k] l k l[j] >= l[i] + l[k] l[j] l j l[i] + l[k] l[i] l i l[k] l k l[k] >= l[i] + l[j] l[k] l k l[i] + l[j] l[i] l i l[j] l j continue ans += 1 ans 1 print(ans) print ans resolve() resolve def resolve():
    from itertools import combinations
    n = int(input())
    l = list(map(int, input().split()))
    ans = 0
    if n < 3:
        print(0)
        return

    for i in range(n):
        for j in range(n):
            for k in range(n):
                if i >= j or j >= k or i >= k:
                    continue
                if l[i] == l[j] or l[j] == l[k] or l[k] == l[i]:
                    continue
                if l[i] >= l[j] + l[k] or l[j] >= l[i] + l[k] or l[k] >= l[i] + l[j]:
                    continue
                ans += 1

    print(ans) def resolve():
    from itertools import combinations
    n = int(input())
    l = list(map(int, input().split()))
    ans = 0
    if n < 3:
        print(0)
        return

    for i in range(n):
        for j in range(n):
            for k in range(n):
                if i >= j or j >= k or i >= k:
                    continue
                if l[i] == l[j] or l[j] == l[k] or l[k] == l[i]:
                    continue
                if l[i] >= l[j] + l[k] or l[j] >= l[i] + l[k] or l[k] >= l[i] + l[j]:
                    continue
                ans += 1

    print(ans) resolve
def resolve():
    from itertools import combinations
    n = int(input())
    l = list(map(int, input().split()))
    ans = 0
    if n < 3:
        print(0)
        return

    for i in range(n):
        for j in range(n):
            for k in range(n):
                if i >= j or j >= k or i >= k:
                    continue
                if l[i] == l[j] or l[j] == l[k] or l[k] == l[i]:
                    continue
                if l[i] >= l[j] + l[k] or l[j] >= l[i] + l[k] or l[k] >= l[i] + l[j]:
                    continue
                ans += 1

    print(ans)

resolve()