import Data.List

combinations :: Int -> [a] -> [[a]]
combinations n xs = comb n (length xs) xs where
  comb 0 _ _ = [[]]
  comb r n a@(x:xs)
    | n == r    = [a]
    | otherwise = map (x:) (comb (r - 1) (n - 1) xs) ++ comb r (n - 1) xs

solve :: [[Int]] -> Int -> Int
solve a ini
 | null a = ini
 | (headA !! 0 == headA !! 1) = solve (tail a) ini
 | (headA !! 1 == headA !! 2) = solve (tail a) ini
 | (headA !! 2 == headA !! 0) = solve (tail a) ini
 | ((headA !! 0) + (headA !! 1)) > (headA !! 2) = solve (tail a) (ini + 1)
 | otherwise = solve (tail a) ini
 where headA = (head a)

main = do
 n <- read <$> getLine :: IO Int
 lk <- map read . words <$> getLine :: IO [Int]
 let lcomb = map sort $ combinations 3 lk
 print $ if(n < 3) then 0 else solve lcomb 0