from itertools import combinations
N = int(input())
nums = list(map(int,input().split()))
tcount = 0
numset = set(nums)
comb = combinations(numset,3)
for i in list(comb):
	a = i[0]
	b = i[1]
	c = i[2]
	if(a+b>c and b+c>a and a+c>b):
		tcount += nums.count(a)*nums.count(b)*nums.count(c)
print(tcount) from itertools import combinations N = int(input()) N int(input()) int input() input nums = list(map(int,input().split())) nums list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split tcount = 0 tcount 0 numset = set(nums) numset set(nums) set nums comb = combinations(numset,3) comb combinations(numset,3) combinations numset 3 for i in list(comb):
	a = i[0]
	b = i[1]
	c = i[2]
	if(a+b>c and b+c>a and a+c>b):
		tcount += nums.count(a)*nums.count(b)*nums.count(c) i list(comb) list comb a = i[0] a i[0] i 0 b = i[1] b i[1] i 1 c = i[2] c i[2] i 2 if(a+b>c and b+c>a and a+c>b):
		tcount += nums.count(a)*nums.count(b)*nums.count(c) a+b>c and b+c>a and a+c>b a+b>c and b+c>a a+b>c a+b a b c b+c>a b+c b c a a+c>b a+c a c b tcount += nums.count(a)*nums.count(b)*nums.count(c) tcount nums.count(a)*nums.count(b)*nums.count(c) nums.count(a)*nums.count(b) nums.count(a) nums.count nums count a nums.count(b) nums.count nums count b nums.count(c) nums.count nums count c print(tcount) print tcount c = i[2] i[2] c tcount = 0 0 tcount comb = combinations(numset,3) combinations(numset,3) comb numset = set(nums) set(nums) numset tcount += nums.count(a)*nums.count(b)*nums.count(c) nums.count(a)*nums.count(b)*nums.count(c) tcount nums = list(map(int,input().split())) list(map(int,input().split())) nums a = i[0] i[0] a b = i[1] i[1] b N = int(input()) int(input()) N
from itertools import combinations
N = int(input())
nums = list(map(int,input().split()))
tcount = 0
numset = set(nums)
comb = combinations(numset,3)
for i in list(comb):
	a = i[0]
	b = i[1]
	c = i[2]
	if(a+b>c and b+c>a and a+c>b):
		tcount += nums.count(a)*nums.count(b)*nums.count(c)
print(tcount)
