n=gets.to_i
s=gets.split.map(&:to_i)
kai=s.repeated_combination(3).to_a
for i in 0..kai.size-1
  if ((kai[i].sum.to_i)-(kai[i].max.to_i)*2)<=0
    kai[i]=nil
  elsif kai[i][0]==kai[i][1] || kai[i][1]==kai[i][2] || kai[i][2]==kai[i][0]
    kai[i]=nil
  end
end
kai.compact!
puts kai.size
