N = gets.to_i
S = gets.chomp

ans = 0
st = [[3, 0]]
while !st.empty?
  n, offset = st.pop
  if n == 0
    ans += 1
    next
  end
  (?0..?9).each{|c|
    idx = S.index(c, offset)
    next if idx.nil?
    st << [n-1, idx + 1]
  }
end

p ans