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