(* O(n^3) *)
let n = read_int ()
let s = read_line ()
let ans = ref 0
let _ =
  for i = 1 to n - 1 do
    let x = String.sub s 0 i in
    let y = String.sub s i @@ n - i in
    let flags = Array.make 128 false in
    let count = ref 0 in
    let f c =
      if not flags.(int_of_char c) then
        (flags.(int_of_char c) <- true;
        try (String.index y c |> ignore; incr count) with
        | _ -> ()) in
    String.iter f x;
    ans := max !ans !count
  done;
  Printf.printf "%d\n" !ans