import Data.List

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

    print $ f l

f l = g l' $ tail l'
    where n = length l
          l' = sort l

g [] _ = 0
g l [] = g l' (tail l')
    where l' = tail l
g l1 l2 = length (takeWhile (< a+b) $ tail l2) + g l1 (tail l2)
    where a = head l1
          b = head l2