import Data.List

main = do
  getLine
  li <- getLine
  let ls = map read $ words li
  print $ compute ls

compute :: [Int] -> Int
compute ls = length
  [ ()
  | (a:ls1) <- tails ls
  , (b:ls2) <- tails ls1
  , a /= b
  , c <- ls2
  , a /= c, b /= c
  , a + b > c, b + c > a, c + a > b
  ]
