n=int(input()) s=input() for i in range(n-1,-1,-1): if s[i] in 'ATGC': print(i+1) exit() print(0)