[<AutoOpen>]
module Program

open System

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

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

    let dp = Array3D.create (N + 1) 4 1000 false
    dp.[0,0,0] <- true

    for i in 0 .. N - 1 do
        for j in 0 .. 3 do
            for k in 0 .. 999 do
                if dp.[i,j,k] then
                    dp.[i+1,j,k] <- true
                    let s = S.[i]
                    if j + 1 <= 3 && k * 10 + s <= 999 then
                        dp.[i+1,j+1,k*10+s] <- true

    seq { for i in 0 .. 999 -> dp.[N,3,i] }
    |> Seq.filter ((=) true)
    |> Seq.length
    |> printfn "%i"

    0