import Data.Array
import Data.List

main :: IO ()
main = do
  getLine
  ls <- map read . words <$> getLine
  print $ solve ls

-- |
-- >>> solve [4, 4, 9, 7, 5]
-- 5
--
-- >>> solve [4, 5, 4, 3, 3, 5]
-- 8
--
-- >>> solve [9, 4, 6, 1, 9, 6, 10, 6, 6, 8]
-- 39
--
-- >>> solve [1, 1]
-- 0
--
-- prop> solve xs >= 0
--
-- prop> solve xs == solve (reverse xs)
--
-- prop> solve xs == solve (sort xs)
--
solve :: [Int] -> Int
solve ls = length [ (i,j,k) 
                  | i <- [1..n]
                  , j <- [i+1..n]
                  , k <- [j+1..n]
                  , let [a,b,c] = sort [ary!i, ary!j, ary!k]
                  , a < b
                  , b < c
                  , a + b > c
                  ]
 where
  n = length ls
  ary = listArray (1, n) ls
