INTEGER N
CHARACTER(100) S
CHARACTER(26)::A="abcdefghijklmnopqrstuvwxyz"
INTEGER B,P
INTEGER M,U
READ*,N,S
P=0
DO I=1, N-1
  B=0
  DO J=1,26
    M=SCAN(S,A(J:J))
    IF(M==0)CYCLE
    U=SCAN(S,A(J:J),.TRUE.)
    IF( M<=I .AND. I<U )B=B+1
  END DO
  P=MAX(P,B)
END DO
PRINT"(I0)",P
END