n = gets.to_i
a = gets.split.map(&:to_i)
count = 0

n.times do |i|
    (i+1).upto(n-1) do |j|
        (j+1).upto(n-1) do |k|
            b = [a[i],a[j],a[k]]
            if b[0]!=b[1] and b[1]!=b[2] and b[0]!=b[2] and b.max < b.sum-b.max 
                count+=1
            end
        end
    end
end
p count