n = gets.to_i
l = gets.split(" ").map(&:to_i)

count = 0
l.combination(3) do |a,b,c|
    if (a != b) && (b != c) && (a != c)
        if (a+b > c) && (a+c > b) && (b+c > a) 
            count += 1
        end
    end
end

puts count
