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