[<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

    seq {
        for c1 in ['0' .. '9'] do
        for c2 in ['0' .. '9'] do
        for c3 in ['0' .. '9'] do
            let pos = Array.create 3 N
            for i in [0 .. N - 1] do
                if S.[i] = c1 && pos.[0] = N then
                    pos.[0] <- i
                if S.[i] = c2 && pos.[1] = N && i > pos.[0] then
                    pos.[1] <- i
                if S.[i] = c3 && pos.[2] = N && i > pos.[1] then
                    pos.[2] <- i
            if Array.forall (fun x -> x < N) pos then
                yield 1
    }
    |> Seq.sum
    |> printfn "%i"

    0