import Data.Maybe
import Data.List
import Text.Printf
import qualified Data.ByteString.Char8 as C

getInts :: IO [Int]
getInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  _ <- getInts
  as <- getInts
  let f [] = 0
      f [_] = 0
      f (x : xs) = g x xs + f xs
      g _ [] = 0
      g x (y : ys) = g x ys + if x == y then 0 else length $ filter (\z -> z /= y && z > x - y) ys
  printf "%d\n" (f $ reverse $ sort as)
