n = gets.chomp.to_i
arr = gets.chomp.split(" ").map(&:to_i)
count = 0
(0...n - 2).each do |i|
    (i + 1...n - 1).each do |j|
        (j + 1...n).each do |k|
            buf = arr[i], arr[j], arr[k]
            a, b, c = buf
            if buf.uniq.length == buf.length && (b - c).abs < a && a < b + c
                count += 1
            end
        end
    end
end
puts count