N = gets.to_i
L = gets.split.map(&:to_i)

answer = 0

L.each.with_index do |a, a_i|
  if a_i + 2 >= L.length
    break
  end
  (a_i + 1..N - 1).each do |b_i|
    c_min = (a - L[b_i]).abs
    c_max = a + L[b_i]
    (b_i + 1..N - 1).each do |c_i|
      if L[c_i] > c_min && L[c_i] < c_max
        answer += 1
       end
    end
  end
end
p answer
