main :: IO ()
main = do
  n <- readLn
  ls <- map read . words <$> getLine
  print $ solve n ls

solve :: Int -> [Int] -> Int
solve n ls = length
  [ (a, b, c)
  | i <- [0 .. n-1]
  , j <- [i+1 .. n-1]
  , k <- [j+1 .. n-1]
  , let (a, b, c) = (ls !! i, ls !! j, ls !! k)
  , a < b + c
  , b < c + a
  , c < a + b
  ]