open System

let isSubArray xs ys =
    let n, m = Array.length xs, Array.length ys
    let rec f i j =
        if i = n then true
        elif j = m then false
        elif xs.[i] = ys.[j] then f (i+1) (j+1)
        else f i (j+1)
    f 0 0

let n = stdin.ReadLine() |> int
let s = stdin.ReadLine().ToCharArray()

let a = List.length [
    for i in ['0'..'9'] do
    for j in ['0'..'9'] do
    for k in ['0'..'9'] do
    if isSubArray [| i; j; k |] s then yield () ]
 
printfn "%d" a