open System

[<EntryPoint>]
let main argv =
    let N = stdin.ReadLine() |> int
    let S = stdin.ReadLine().ToCharArray()

    let mutable count = 0

    let rec found (start : int, stop: int, index: char) =
        if (start >= stop) then
            -1
         else if S.[start] = index then
            start
         else
            found(start + 1, stop, index)

    let found2 (i : int, j : int, k : int) =
        let f1 = found(0, N, '0' + char i)
        if (f1 >= 0) then
            let f2 = found(f1 + 1, N, '0' + char j)
            if (f2 >= 0) then
                let f3 = found(f2 + 1, N, '0' + char k)
                if (f3 >= 0) then
                    1
                else
                    0
            else
                0
        else
            0

    for i = 0 to 9 do
        for j = 0 to 9 do
            for k = 0 to 9 do
                count <- count + found2(i, j, k)

    printfn "%d" count

    0