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
		if [ ${a[i]} -lt ${a[j]} ];then
			s=$[${a[i]}+${a[j]}]
			for((k=j+1;k<n;k++));do
				if [ ${a[j]} -lt ${a[k]} -a $s -gt $[${a[k]}] ];then
					cnt=$[cnt+1]
				fi
			done
		fi
	done
done
echo $cnt
