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

c = 0

(0..N-3).each {|i|
  (i+1..N-2).each {|j|
    (j+1..N-1).each {|k|
      if L[i] < L[j] + L[k] && L[j] < L[k] + L[i] && L[k] < L[i] + L[j]
          c += 1
      end
    }
  }
}

puts c
