import Data.List

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

    print $ f l

f l = g n (sort l) 0 1
    where n = length l

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