inpu []       = 0
inpu (a:x) = inpu' x + (inpu x)
 where
  inpu' [] = 0
  inpu' (b:y) = inpu'' y + (inpu' y)
   where
    inpu'' [] = 0
    inpu'' (c:z)
     |(a+b>c)&&(b+c>a)&&(c+a>b) =  inpu'' z + 1
     |otherwise = inpu'' z

main = do
 _ <- getLine
 xs <- map read . words <$> getLine :: IO [Int]
 print $ inpu xs