from collections import defaultdict
import itertools

N = int(input())

L = list(map(int, input().split()))

dic = defaultdict(int)

for num in L:
    dic[num] += 1

set_L = set(L)

comb = list(itertools.combinations(set_L, 3))

ans = 0
for a,b,c in comb:
    if a+b <= c or b+c<=a or c+a <= b: continue
    ans += dic[a] * dic[b] * dic[c]

print(ans) from collections import defaultdict import itertools itertools 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 dic = defaultdict(int) dic defaultdict(int) defaultdict int for num in L:
    dic[num] += 1 num L dic[num] += 1 dic[num] dic num 1 set_L = set(L) set_L set(L) set L comb = list(itertools.combinations(set_L, 3)) comb list(itertools.combinations(set_L, 3)) list itertools.combinations(set_L, 3) itertools.combinations itertools combinations set_L 3 ans = 0 ans 0 for a,b,c in comb:
    if a+b <= c or b+c<=a or c+a <= b: continue
    ans += dic[a] * dic[b] * dic[c] a b c comb if a+b <= c or b+c<=a or c+a <= b: continue
     a+b <= c or b+c<=a or c+a <= b a+b <= c or 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 ans += dic[a] * dic[b] * dic[c] ans dic[a] * dic[b] * dic[c] dic[a] * dic[b] dic[a] dic a dic[b] dic b dic[c] dic c print(ans) print ans comb = list(itertools.combinations(set_L, 3)) list(itertools.combinations(set_L, 3)) comb L = list(map(int, input().split())) list(map(int, input().split())) L N = int(input()) int(input()) N ans = 0 0 ans ans += dic[a] * dic[b] * dic[c] dic[a] * dic[b] * dic[c] ans dic = defaultdict(int) defaultdict(int) dic set_L = set(L) set(L) set_L
from collections import defaultdict
import itertools

N = int(input())

L = list(map(int, input().split()))

dic = defaultdict(int)

for num in L:
    dic[num] += 1

set_L = set(L)

comb = list(itertools.combinations(set_L, 3))

ans = 0
for a,b,c in comb:
    if a+b <= c or b+c<=a or c+a <= b: continue
    ans += dic[a] * dic[b] * dic[c]

print(ans)
