n = gets.to_i
ln=gets.chomp.split(" ").map(&:to_i);
cnt = 0

ln.combination(3).to_a.each do |x|
    a = x[0] + x[1]
    b = x[0] + x[2]
    c = x[1] + x[2]
    if (a > x[2]) && (b > x[1]) && (c > x[0]) && (x.uniq.count - x.count == 0)
        cnt += 1
    end
end

puts cnt
