def resolve():
    # 最長の辺の長さ < 他の辺の長さの合計 で三角形
    N = int(input())
    lines = map(int, input().split())
    #N = 100
    #from random import randint
    #lines = [randint(1, 10 ** 9) for x in range(N)]
    from itertools import combinations
    count = 0
    for c in combinations(lines, 3):
        if len(set(c)) != 3:
            continue
        if max(c) < sum(c)-max(c):
            count += 1
    print(count)
resolve() def resolve():
    # 最長の辺の長さ < 他の辺の長さの合計 で三角形
    N = int(input())
    lines = map(int, input().split())
    #N = 100
    #from random import randint
    #lines = [randint(1, 10 ** 9) for x in range(N)]
    from itertools import combinations
    count = 0
    for c in combinations(lines, 3):
        if len(set(c)) != 3:
            continue
        if max(c) < sum(c)-max(c):
            count += 1
    print(count) resolve N = int(input()) N int(input()) int input() input lines = map(int, input().split()) lines map(int, input().split()) map int input().split() ().split () input split from itertools import combinations count = 0 count 0 for c in combinations(lines, 3):
        if len(set(c)) != 3:
            continue
        if max(c) < sum(c)-max(c):
            count += 1
     c combinations(lines, 3) combinations lines 3 if len(set(c)) != 3:
            continue
         len(set(c)) != 3 len(set(c)) len set(c) set c 3 continue if max(c) < sum(c)-max(c):
            count += 1
     max(c) < sum(c)-max(c) max(c) max c sum(c)-max(c) sum(c) sum c max(c) max c count += 1 count 1 print(count) print count resolve() resolve def resolve():
    # 最長の辺の長さ < 他の辺の長さの合計 で三角形
    N = int(input())
    lines = map(int, input().split())
    #N = 100
    #from random import randint
    #lines = [randint(1, 10 ** 9) for x in range(N)]
    from itertools import combinations
    count = 0
    for c in combinations(lines, 3):
        if len(set(c)) != 3:
            continue
        if max(c) < sum(c)-max(c):
            count += 1
    print(count) def resolve():
    # 最長の辺の長さ < 他の辺の長さの合計 で三角形
    N = int(input())
    lines = map(int, input().split())
    #N = 100
    #from random import randint
    #lines = [randint(1, 10 ** 9) for x in range(N)]
    from itertools import combinations
    count = 0
    for c in combinations(lines, 3):
        if len(set(c)) != 3:
            continue
        if max(c) < sum(c)-max(c):
            count += 1
    print(count) resolve
def resolve():
    # 最長の辺の長さ < 他の辺の長さの合計 で三角形
    N = int(input())
    lines = map(int, input().split())
    #N = 100
    #from random import randint
    #lines = [randint(1, 10 ** 9) for x in range(N)]
    from itertools import combinations
    count = 0
    for c in combinations(lines, 3):
        if len(set(c)) != 3:
            continue
        if max(c) < sum(c)-max(c):
            count += 1
    print(count)
resolve()