n = gets.chomp.to_i
s = gets.chomp

count = ('000'..'999').count do |candidate|
  i1 = s[0...n-2].chars.find_index(candidate[0])
  next false unless i1
  i2 = s[i1+1...n-1].chars.find_index(candidate[1])
  next false unless i2
  s[i1+i2+2...n].chars.find_index(candidate[2])
end

puts count
