module S = Set.Make (struct type t = int let compare = compare end)

let () =
    let main () =
        let n = int_of_string (read_line ()) in
        let s = read_line () in
        let s0 = S.singleton 0 in
        let add d sa sb = S.fold (fun v acc -> S.add (v * 10 + d) acc) sb sa in
        let rec loop i s1 s2 s3 =
            if i = n then S.cardinal s3 else (
                let k = int_of_char s.[i] - int_of_char '0' in
                let s3 = add k s3 s2 in
                let s2 = add k s2 s1 in
                let s1 = add k s1 s0 in
                loop (i + 1) s1 s2 s3
            )
        in
        let r = loop 0 S.empty S.empty S.empty in
        Printf.printf "%d\n" r
    in
    main ()