open Batteries

let xs = Array.make 26 false

let main () =
  let n, s = Scanf.scanf "%d\n%s" (fun x y -> x, y) in
  let ans = ref 0 in
  for i = 1 to n - 2 do
    let x = String.slice ~first:0 ~last:(i+1) s in
    let y = String.slice ~first:(i+1) ~last:n s in
    for i = 0 to 25 do
      let c = Char.chr (i+97) in
      xs.(i) <- String.contains x c && String.contains y c
    done;
    ans := max !ans (Array.fold_left (fun acc x -> if x then acc + 1 else acc) 0 xs);
    Array.fill xs 0 25 false;
  done;
  Printf.printf "%d\n" !ans

let _ = main ()
