program main
  implicit none
  integer :: n, i, res
  character(100) :: s, l, r
  read(*, *) n
  read(*, *) s
  res = 0
  do i = 1, n - 1  ! Cut after i-th char
    l = s(1:i)
    r = s(i + 1:n)
    res = max(res, sum(exist_mask(l) * exist_mask(r)))
  end do
  write(*, "(i0)") res

  contains

  function exist_mask(s)
    implicit none
    character(26), parameter :: abc = "abcdefghijklmnopqrstuvwxyz"
    integer :: exist_mask(26)
    character(100), intent(in) :: s
    integer :: i, j
    exist_mask(:) = 0
    do i = 1, 26
      do j = 1, 100
        if (abc(i:i) == s(j:j)) then
          exist_mask(i) = 1
        end if
      end do
    end do
  end function exist_mask
end program main
