import Data.List
f :: Int -> [Int] -> Int -> Int -> Int
f a x m n 
    | n >= (length x) = 0
    | (a + (x !! m) > (x !! n)) = n - m + (f a x m (n + 1))
    | m + 1  == n = (f a x m (n + 1))
    | otherwise = f a x (m + 1) n

g :: [Int] -> Int
g [] = 0
g (a:x) = (f a x 0 1) + (g x)

main = do
    getLine
    x <- getLine >>= return . sort . (map (read :: String -> Int)) . words
    putStrLn $ show $ g x
    -- putStrLn $ show $ g [3,4,4,5,5]