n = gets.chomp.to_i
l = gets.chomp.split(' ').map(&:to_i)

if (n < 3)
  puts 0
  exit
end

def ok?(abc)
  return false if (abc.uniq.size != 3)
  return false if (abc.max >= abc.min(2).sum)
  true
end

count = 0
l.combination(3).to_a.each do |abc|
  count += 1 if (ok?(abc))
end
puts count