_=input() S=input() T='ACGT' ans=0 for t in T: ans=max(ans,S.find(t)+1) print(ans)