n = gets.to_i
l = gets.split.map(&:to_i).sort
ans = 0
n.times do |i|
    ((i+1)...n).each do |j|
        ((j+1)...n).each do |k|
            ans += 1 if l[i] != l[j] && l[j] != l[k] && l[i]+l[j] > l[k]
        end
    end
end
puts ans