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) 1
    where n = length l

g n l j
    | n == 0 = 0
    | j == n = g (n-1) (tail l) 1
    | otherwise = length (takeWhile (< a+b) $ drop j l) - 1 + g n l (j+1)
        where a = head l
              b = l !! j