n=gets.to_i
s=gets.chomp.chars.map(&:to_i)
z=s.reverse
f=[]
l=[]
10.times do |i|
  f[i]=s.index(i)
  f[i]=f[i]+1 if f[i]
  l[i]=z.index(i)
  l[i]=n-2-l[i] if l[i]
end
a=0
[*0..9].repeated_permutation(2) do |ff,ll|
  c=[0]*10
  if f[ff]&&l[ll]
    f[ff].upto(l[ll]) do |i|
      c[s[i]]=1 if c[s[i]]=0
    end
  end
  a+=c.count(1)
end
puts a
