import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)
import Data.List (tails)

combinations :: Int -> [a] -> [[a]]
combinations 0 _  = [[]]
combinations n xs = [ y:ys | y:xs' <- tails xs
                           , ys <- combinations (n-1) xs' ]

main :: IO ()
main = do
    n <- readLn :: IO Int
    l <- map (fst . fromJust . BS.readInt)
        . BS.words <$> BS.getLine :: IO [Int]
    let cmb = combinations 3 l
    print $ foldr (\x a -> a + f x) 0 cmb
  where f [a,b,c] = if a < b + c && b < c + a && c < a + b then 1 else 0
