open Printf
open Scanf


let count (s1, s2) =
  let count_array s =
    let toi x = int_of_char x - int_of_char 'a' in
    let a = Array.make (toi 'z' + 1) 0 in
    String.iter (fun x -> a.(toi x) <- 1) s;
    a in
  let a1 = count_array s1 in
  let a2 = count_array s2 in
  let b = Array.map2 (fun a b ->
      match (a, b) with
      | (1, 1) -> 1
      | _ -> 0
    ) a1 a2 in
  Array.fold_left (+) 0 b

let split_string s i length =
  let s1 = String.sub s 0 i in
  let s2 = String.sub s i (length - i) in
  (s1, s2)

let main =
  let (length, s) = scanf "%d\n%s" (fun a b -> (a, b)) in
  let rec iter i v =
    match i with
    | i when i = length -> v
    | i -> iter (i + 1) (max (count (split_string s i length)) v)
  in printf "%d\n" (iter 2 (count (split_string s 1 length)))


