N = int(input()) S = input() ans=0 pos=[0]*N c=0 for i in range(N): if S[i]=="A" or S[i]=="G" or S[i]=="C" or S[i]=="T": pos[i]=1 c+=1 if c>0: ans=0 kesu=c-1 moto=c-1 next=c-1 for i in range(N): # print(next) ans+=1 if pos[next]==1: moto-=1 next=moto if moto<0: break else: kesu+=1 next=kesu if kesu>(N-1): break print(ans) else: print(0)