import sys
from collections import Counter
from itertools import combinations


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    N = int(input())
    L = list(map(int, input().split()))
    count = Counter(L)
    key = count.keys()

    set_list = combinations(key, 3)
    answer = 0
    for s in set_list:
        a = s[0]
        b = s[1]
        c = s[2]
        if (a + b) > c and (b + c) > a and (c + a) > b:
            answer += count[a] * count[b] * count[c]
    print(answer)


if __name__ == "__main__":
    main() import sys sys from collections import Counter from itertools import combinations def input():
    return sys.stdin.readline().strip() input return sys.stdin.readline().strip() sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip sys.setrecursionlimit(20000000) sys.setrecursionlimit sys setrecursionlimit 20000000 MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 INF = float("inf") INF float("inf") float "inf" def main():
    N = int(input())
    L = list(map(int, input().split()))
    count = Counter(L)
    key = count.keys()

    set_list = combinations(key, 3)
    answer = 0
    for s in set_list:
        a = s[0]
        b = s[1]
        c = s[2]
        if (a + b) > c and (b + c) > a and (c + a) > b:
            answer += count[a] * count[b] * count[c]
    print(answer) 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 count = Counter(L) count Counter(L) Counter L key = count.keys() key count.keys() count.keys count keys set_list = combinations(key, 3) set_list combinations(key, 3) combinations key 3 answer = 0 answer 0 for s in set_list:
        a = s[0]
        b = s[1]
        c = s[2]
        if (a + b) > c and (b + c) > a and (c + a) > b:
            answer += count[a] * count[b] * count[c]
     s set_list a = s[0] a s[0] s 0 b = s[1] b s[1] s 1 c = s[2] c s[2] s 2 if (a + b) > c and (b + c) > a and (c + a) > b:
            answer += count[a] * count[b] * count[c]
     (a + b) > c and (b + c) > a and (c + a) > b (a + b) > c and (b + c) > a (a + b) > c a + b a b c (b + c) > a b + c b c a (c + a) > b c + a c a b answer += count[a] * count[b] * count[c] answer count[a] * count[b] * count[c] count[a] * count[b] count[a] count a count[b] count b count[c] count c print(answer) print answer if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    N = int(input())
    L = list(map(int, input().split()))
    count = Counter(L)
    key = count.keys()

    set_list = combinations(key, 3)
    answer = 0
    for s in set_list:
        a = s[0]
        b = s[1]
        c = s[2]
        if (a + b) > c and (b + c) > a and (c + a) > b:
            answer += count[a] * count[b] * count[c]
    print(answer) def main():
    N = int(input())
    L = list(map(int, input().split()))
    count = Counter(L)
    key = count.keys()

    set_list = combinations(key, 3)
    answer = 0
    for s in set_list:
        a = s[0]
        b = s[1]
        c = s[2]
        if (a + b) > c and (b + c) > a and (c + a) > b:
            answer += count[a] * count[b] * count[c]
    print(answer) main MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD def input():
    return sys.stdin.readline().strip() def input():
    return sys.stdin.readline().strip() input INF = float("inf") float("inf") INF
import sys
from collections import Counter
from itertools import combinations


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    N = int(input())
    L = list(map(int, input().split()))
    count = Counter(L)
    key = count.keys()

    set_list = combinations(key, 3)
    answer = 0
    for s in set_list:
        a = s[0]
        b = s[1]
        c = s[2]
        if (a + b) > c and (b + c) > a and (c + a) > b:
            answer += count[a] * count[b] * count[c]
    print(answer)


if __name__ == "__main__":
    main()
