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