open Batteries

let () =
  let n = Scanf.scanf "%d " (fun a -> a) in
  let s = Scanf.scanf "%s " (fun a -> a) in

  let char_arr = Array.of_list (String.to_list s) in
  let res = ref 0 in

  for i = 0 to (n-1) do
    let left = Array.sub char_arr 0 i in
    let right = Array.sub char_arr i (n-i) in

    let left_l = List.unique (Array.to_list left) in
    let right_l = List.unique (Array.to_list right) in

    let intersection xs ys =
      List.fold_left (fun a b -> if List.mem b ys then (b::a) else a) [] xs
    in

    let v = List.length (intersection left_l right_l) in
    if v > !res then res := v

  done;

  print_endline (string_of_int (!res))
