require 'set'

N = gets.to_i
S = gets.chomp

# i 文字目以降で最初に文字 c が登場する index (存在しないときは n)
def calc_next
    res = Array.new(N+1) { Array.new(10) { N } }
    (0..(N-1)).to_a.reverse_each do |i|
        (0..9).each do |j|
            res[i][j] = res[i+1][j]
        end
        res[i][S[i].to_i] = i
    end
    res
end

nexts = calc_next

dp = Array.new(N+1) { Array.new(4) {0} }
dp[0][0] = 1
(0..(N-1)).each do |i|
    (0..9).each do |j|
        next if nexts[i][j] >= N
        dp[nexts[i][j] + 1][1] +=  dp[i][0]
        dp[nexts[i][j] + 1][2] +=  dp[i][1]
        dp[nexts[i][j] + 1][3] +=  dp[i][2]
    end
end

puts dp.inject(0) {|sum, n| sum + n[3] }
