read n
read al
a=(`echo $al|tr ' ' '\n'|sort -n`)
cnt=0
for((i=0;i<n;i++));do
	for((j=i+1;j<n;j++));do
		for((k=j+1;k<n;k++));do
			if [ ${a[i]} -lt ${a[j]} -a ${a[j]} -lt ${a[k]} ];then
				if [ $[${a[i]}+${a[j]}] -gt $[${a[k]}] ];then
					cnt=$[cnt+1]
				fi
			fi
		done
	done
done
echo $cnt
