let _ = read_int ()
let s, ans = read_line (), ref 0
let f n = Char.chr (48 + n)
let _ = for i = 0 to 9 do for j = 0 to 9 do for k = 0 to 9 do try String.(index_from s (index_from s (index s (f i) + 1) (f j) + 1) (f k)) |> ignore; incr ans with _ -> () done done done; Printf.printf "%d\n" !ans