n=gets.to_i
a=gets.split.map(&:to_i)
a.sort!
count=0
for i in 0..a.length-1
    for j in i+1..a.length-1
        if a[i]==a[j]
            next
        end
       v=a[j+1..-1]
       v.delete(a[j])
       #p v
        result=[]
         v.each do |n|
            if a[i]+a[j]>n
                result<<n
            end
        end
        
      #p result
        count+=result.length
    end
end
p count