n = gets().to_i

l = gets().split(" ").map{|i| i.to_i}.sort
n = l.length

t = 0
for i in 0..n-3 do
    for j in (i+1)..n-2 do
        for k in (j+1)..n-1 do
            if l[i] == l[j]
                next
            end
            next if l[j] == l[k]
            next if l[k] == l[i]
            t += 1 if (l[i] + l[j] > l[k])
        end
    end
end
print(t)