n = gets.to_i
s = gets.chomp

count = 0

(0..999).each{ |i|
	index = 0
	sprintf("%03d", i).split("").each{ |ss|
		index = s.index(ss, index)
		if index == nil then
			break
		else
			index += 1
		end
	}
	if index != nil then
		count += 1
	end
}

puts count
