import Data.List



select :: [a] -> [(a, [a])]
select [x]    = [(x, [])]
select (x:xs) = (x, xs) : map (\(y, ys) -> (y, x:ys)) (select xs)

combinations :: Int -> [Int] -> [[Int]]
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

main = do
  n <- getLine
  xs <- map read . words <$> getLine
  print $ filter (\[a, b, c] -> a + b > c && b + c > a && c + a > b) $ filter (\[a, b, c] -> a /= b && a/=c && c/=b) $ combinations 3 xs