import Data.List

main :: IO ()
main = do
    l1 <- getLine
    l2 <- getLine
    let l = map read $ words l2 :: [Int]

    print $ f l

f l = sum $ map (g $ sort l) [(i, j) | i <- [0..n], j <- [0..n]]
    where n = length l - 1

g l (i, j)
    | i >= j = 0
    | otherwise = length (takeWhile (< a+b) l) - j - 1
        where a = l !! i
              b = l !! j