n = int(input())
l = list(map(int,input().split()))

l_dic = {}
for i in range(n):
    if l[i] not in l_dic:
        l_dic[l[i]] = 0
    l_dic[l[i]] += 1

l_item = list(l_dic.items())
l_item.sort(key = lambda x:x[0])

if len(l_dic) < 3:
    print(0)
    exit()

ans = 0
for i in range(len(l_item)):
    for j in range(i+1,len(l_item)):
        for k in range(j+1,len(l_item)):
            if l_item[i][0] + l_item[j][0] > l_item[k][0] and l_item[i][0] + l_item[k][0] > l_item[j][0] and l_item[k][0] + l_item[j][0] > l_item[i][0]:
                ans += 1*l_item[i][1]*l_item[j][1]*l_item[k][1]

print(ans)



 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 l_dic = {} l_dic {} for i in range(n):
    if l[i] not in l_dic:
        l_dic[l[i]] = 0
    l_dic[l[i]] += 1 i range(n) range n if l[i] not in l_dic:
        l_dic[l[i]] = 0
     l[i] not in l_dic l[i] l i l_dic l_dic[l[i]] = 0 l_dic[l[i]] l_dic l[i] l i 0 l_dic[l[i]] += 1 l_dic[l[i]] l_dic l[i] l i 1 l_item = list(l_dic.items()) l_item list(l_dic.items()) list l_dic.items() l_dic.items l_dic items l_item.sort(key = lambda x:x[0]) l_item.sort l_item sort key = lambda x:x[0] key lambda x:x[0] x[0] x 0 x if len(l_dic) < 3:
    print(0)
    exit() len(l_dic) < 3 len(l_dic) len l_dic 3 print(0) print 0 exit() exit ans = 0 ans 0 for i in range(len(l_item)):
    for j in range(i+1,len(l_item)):
        for k in range(j+1,len(l_item)):
            if l_item[i][0] + l_item[j][0] > l_item[k][0] and l_item[i][0] + l_item[k][0] > l_item[j][0] and l_item[k][0] + l_item[j][0] > l_item[i][0]:
                ans += 1*l_item[i][1]*l_item[j][1]*l_item[k][1] i range(len(l_item)) range len(l_item) len l_item for j in range(i+1,len(l_item)):
        for k in range(j+1,len(l_item)):
            if l_item[i][0] + l_item[j][0] > l_item[k][0] and l_item[i][0] + l_item[k][0] > l_item[j][0] and l_item[k][0] + l_item[j][0] > l_item[i][0]:
                ans += 1*l_item[i][1]*l_item[j][1]*l_item[k][1] j range(i+1,len(l_item)) range i+1 i 1 len(l_item) len l_item for k in range(j+1,len(l_item)):
            if l_item[i][0] + l_item[j][0] > l_item[k][0] and l_item[i][0] + l_item[k][0] > l_item[j][0] and l_item[k][0] + l_item[j][0] > l_item[i][0]:
                ans += 1*l_item[i][1]*l_item[j][1]*l_item[k][1] k range(j+1,len(l_item)) range j+1 j 1 len(l_item) len l_item if l_item[i][0] + l_item[j][0] > l_item[k][0] and l_item[i][0] + l_item[k][0] > l_item[j][0] and l_item[k][0] + l_item[j][0] > l_item[i][0]:
                ans += 1*l_item[i][1]*l_item[j][1]*l_item[k][1] l_item[i][0] + l_item[j][0] > l_item[k][0] and l_item[i][0] + l_item[k][0] > l_item[j][0] and l_item[k][0] + l_item[j][0] > l_item[i][0] l_item[i][0] + l_item[j][0] > l_item[k][0] and l_item[i][0] + l_item[k][0] > l_item[j][0] l_item[i][0] + l_item[j][0] > l_item[k][0] l_item[i][0] + l_item[j][0] l_item[i][0] [i] l_item i 0 l_item[j][0] [j] l_item j 0 l_item[k][0] [k] l_item k 0 l_item[i][0] + l_item[k][0] > l_item[j][0] l_item[i][0] + l_item[k][0] l_item[i][0] [i] l_item i 0 l_item[k][0] [k] l_item k 0 l_item[j][0] [j] l_item j 0 l_item[k][0] + l_item[j][0] > l_item[i][0] l_item[k][0] + l_item[j][0] l_item[k][0] [k] l_item k 0 l_item[j][0] [j] l_item j 0 l_item[i][0] [i] l_item i 0 ans += 1*l_item[i][1]*l_item[j][1]*l_item[k][1] ans 1*l_item[i][1]*l_item[j][1]*l_item[k][1] 1*l_item[i][1]*l_item[j][1] 1*l_item[i][1] 1 l_item[i][1] [i] l_item i 1 l_item[j][1] [j] l_item j 1 l_item[k][1] [k] l_item k 1 print(ans) print ans l_dic = {} {} l_dic ans += 1*l_item[i][1]*l_item[j][1]*l_item[k][1] 1*l_item[i][1]*l_item[j][1]*l_item[k][1] ans ans = 0 0 ans l = list(map(int,input().split())) list(map(int,input().split())) l n = int(input()) int(input()) n l_item = list(l_dic.items()) list(l_dic.items()) l_item
n = int(input())
l = list(map(int,input().split()))

l_dic = {}
for i in range(n):
    if l[i] not in l_dic:
        l_dic[l[i]] = 0
    l_dic[l[i]] += 1

l_item = list(l_dic.items())
l_item.sort(key = lambda x:x[0])

if len(l_dic) < 3:
    print(0)
    exit()

ans = 0
for i in range(len(l_item)):
    for j in range(i+1,len(l_item)):
        for k in range(j+1,len(l_item)):
            if l_item[i][0] + l_item[j][0] > l_item[k][0] and l_item[i][0] + l_item[k][0] > l_item[j][0] and l_item[k][0] + l_item[j][0] > l_item[i][0]:
                ans += 1*l_item[i][1]*l_item[j][1]*l_item[k][1]

print(ans)




