import Data.List
main = do
  _ <- getLine
  l' <- map (read::String->Int) . words <$> getLine
  let l = zip [1..] l'
  print $ length [(,,)|a<-l, b<-(delete a l), c<-(delete b (delete a l)),
                      (snd a)+(snd b)>(snd c),
                      (snd b)+(snd c)>(snd a),
                      (snd c)+(snd a)>(snd b),
                      (snd a)/=(snd b),
                      (snd b)/=(snd c),
                      (snd c)/=(snd a),
                      (fst a)<(fst b),
                      (fst b)<(fst c)]