open System

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f

let isOk n (s: string) (t: string) =
    let mutable res = false
    for i in 0..n-3 do
        if s.[i] = t.[0] then
            for j in i+1..n-2 do
                if s.[j] = t.[1] then
                    for k in j+1..n-1 do
                        if s.[k] = t.[2] then res <- true
    res

[<EntryPoint>]
let main _ =
    let N = read int
    let S = read string

    let mutable ans = 0
    for i in 0..9 do
        for j in 0..9 do
            for k in 0..9 do
                let t = sprintf "%d%d%d" i j k
                if (isOk N S t) then ans <- ans + 1

    printfn "%d" ans
    0 // return an integer exit code
