Scanf.scanf "%d %s" (fun n s ->
    let count s1 s2 =
        let hist s =
            let h = Array.make 26 false in
            String.iter (fun c -> h.(int_of_char c - 97) <- true) s;
            h

        in
        let f1 = hist s1 in
        let f2 = hist s2 in
        let rec loop i acc =
            if i = 26 then acc else
                let acc = if f1.(i) && f2.(i) then acc + 1 else acc in
                loop (i + 1) acc
        in
        loop 0 0
    in
    let rec loop i acc =
        if i = n then acc else
            let acc = max acc (count (String.sub s 0 i) (String.sub s i (n - i))) in
            loop (i + 1) acc
    in
    loop 0 0 |> Printf.printf "%d\n"
)