isTriangle :: (Int, Int, Int) -> Bool
isTriangle (a, b, c)
    | a < b + c && b < a + c && c < a + b = True
    | otherwise = False

solve :: [Int] -> Int
solve xs = length . filter isTriangle $ ys
    where ys = [(a, b, c) | a <- xs, b <- xs, c <- xs, a < b, b < c]

main =getLine >> getLine >>= print . solve . map read . words