import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (n  : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  ls <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  let
    x :: Int
    (_, _, x) = foldr step ([], [], 0) $ ls
    step :: Int -> ([Int], [(Int, Int)], Int) -> ([Int], [(Int, Int)], Int)
    step l (ls', ps', k) = (l : ls', map ((,) l) ls' ++ ps', length (filter (c l) ps') + k)
    c :: Int -> (Int, Int) -> Bool
    c a = \(b, c) -> a < b + c && b < c + a && c < a + b
  print x

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n
