n = gets.chomp.to_i
s = gets.chomp
count = 0
(0..999).each{|elem|
  bangou = format('%03d', elem)
  replace_str = s.sub(/.*#{bangou[0]}.*#{bangou[1]}.*#{bangou[2]}.*/,"")
  if s.length != replace_str.length
    count +=1
  else
  end
  }
puts count
