
N=gets.to_i
S=gets.chomp

next_cache=Array.new(S.length+1){Array.new(10,-1)}



S.each_char.reverse_each.each_with_index do |c,i|
  10.times do |n|
    next_cache[N-1-i][n]=next_cache[N-i][n]
    next_cache[N-1-i][n]=N-1-i if c==n.to_s
  end
end


x=("0".."9").to_a
ans=0
x.product(x,x) do |a,b,c|
  pos=next_cache[0][a.to_i]
  next if pos==-1
  pos=next_cache[pos+1][b.to_i]
  next if pos==-1
  pos=next_cache[pos+1][c.to_i]
  next if pos==-1
  ans+=1
end
p ans


