nun_sticks = gets.chomp.to_i
stick_lengths = gets.chomp.split(" ").map(&:to_i)
previous_slime_color = ""
num_triangles_can_be_made = 0
stick_lengths.combination(3).each do |combo_stick_length|
    a = combo_stick_length[0]
    b = combo_stick_length[1]
    c = combo_stick_length[2]
    if a < b + c && b < c + a && c < a + b
        num_triangles_can_be_made += 1
    end
end
puts num_triangles_can_be_made