N = gets.to_i
S = gets.chomp

ans = 0
1000.times do |x|
  s = ("%03d" % x).chars
  i = 0
  S.each_char do |c|
    i += 1 if s[i] == c
    if i == 3
      ans += 1
      break
    end
  end
end
puts ans