Public Class Program
  Shared Sub Main()
    Dim n As Integer = Integer.Parse(Console.ReadLine())
    Dim l As Integer() = Array.ConvertAll(Of String, Integer)(Console.ReadLine().Split(" "), AddressOf Integer.Parse)
    Dim ans As Integer = 0
    For i As Integer = 0 To n - 3
      Dim a As Integer = l(i)
      For j As Integer = i + 1 To n - 2
        Dim b As Integer = l(j)
        For k As Integer = J + 1 To n - 1
          Dim c As Integer = l(k)
          If a < b + c AndAlso b < c + a AndAlso c < a + b Then ans += 1
        Next
      Next
    Next
    Console.WriteLine(ans.ToString())
  End Sub
End Class