let n, s = Scanf.scanf " %d %s" @@ fun a b -> a, b
let ans = ref 0
let _ =
  for i = 1 to n - 1 do
    let c = ref 0 in
    for j = Char.code 'a' to Char.code 'z' do
      if String.contains (String.sub s 0 i) @@ Char.chr j && String.contains (String.sub s i @@ n - i) @@ Char.chr j then incr c done;
    ans := max !ans !c done;
  Printf.printf "%d\n" !ans