N=int(input()) p=[int(c in 'AGCT') for c in input()] for i,n in enumerate(p[::-1]): if n>0: break else: i+=1 print(N-i)