N = gets.to_i
L = gets.chomp.split(' ')

invalid_count = 0

LL = L.combination(3).to_a
LL.each do |l|
  if l[0] == l[1] || l[1] == l[2] || l[0] == l[2]
    invalid_count += 1
  elsif l.sort.reverse[0].to_i >= l.sort.reverse[1].to_i + l.sort.reverse[2].to_i
    invalid_count += 1
  end
end

p LL.count - invalid_count