n = gets.to_i
l = gets.chomp.split.map(&:to_i).sort!

res = 0
0.step(n - 3) do |i|
  (i + 1).step(n - 2) do |j|
    if l[i] == l[j]
      next
    end
    (j + 1).step(n - 1) do |k|
      if l[j] == l[k]
        next
      end
      if l[k] < l[i] + l[j]
        res += 1
      end
    end
  end
end
puts res