n = gets.to_i
s = gets.chomp

ans = 0

[*'0'..'9'].repeated_permutation(3).to_a.each do |x|
  now = 0
  n.times do |t|
    now += 1 if x[now] == s[t]
    if now == 3
      ans += 1
      break
    end
  end
end

puts ans
