import Control.Monad
import Data.List

solve 0 xs = [[]]
solve _ [] = []
solve n (x:xs) = [x:y | y <- solve (n-1) xs] ++ solve n xs

isT a b c = (a + b > c && a + c > b && b + c > a)


main = do
    n <- readLn :: IO Int
    ls <- map read . words <$> getLine :: IO [Int]
    if n >= 3
        then print $ length $ filter (\xs -> (length $ group $ sort xs) == 3 && isT (xs!!0) (xs!!1) (xs!!2)) $ map sort $ solve 3 ls
        else print $ 0