n = int(input()) s = list(input()) ans = 0 for i in range(n): if s[i]=='A' or s[i]=='G' or s[i]=='C' or s[i]=='T': ans = i+1 print(ans)