[<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).ToCharArray()

    let mutable cnt = 0
    for i = 0 to 999 do
        let c = [| i / 100; (i / 10) % 10; i % 10 |]
        seq {
            let mutable f = 0
            for j = 0 to N - 1 do
                if int S.[j] = (int '0' + c.[f]) then
                    f <- f + 1
                if f = 3 then yield ()
        }
        |> fun s ->
            if not (Seq.isEmpty s) then cnt <- cnt + 1

    printfn "%i" cnt
    0