[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reada f = stdin.ReadLine().Split() |> Array.map f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

[<EntryPoint>]
let main _ =
    let N = read int
    let S = read string |> Seq.toArray

    let f1 (vs: char []) =
        seq {
            let mutable c = 0
            for i in [0 .. N - 1] do
                if S.[i] = vs.[c] then
                    c <- c + 1
                    if c = 3 then yield ()
        }
        |> Seq.isEmpty |> not

    [|
        for i in ['0' .. '9'] do
        for j in ['0' .. '9'] do
        for k in ['0' .. '9'] do
            yield [|i;j;k|]
    |]
    |> Array.filter f1
    |> Array.length
    |> printfn "%i"

    0