import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as V
main=print.solve.unfoldr(B.readInt.B.dropWhile isSpace)=<<B.getContents
solve(n:ls)=length[True|i<-[0..n-1],j<-[i+1..n-1],k<-[j+1..n-1],f[i,j,k]]where
  vs=V.fromList ls
  f=(\d@[a,b,c]->a+b>c&&a/=b&&b/=c).sort.map(vs V.!)