inf=10**18 dxy=[(0,1), (1,0), (-1, 0), (0, -1)] mod=10**9+7 MOD=998244353 def main(): N = int(input()) S = input() cnt = 0 keys = ["A", "G", "C", "T"] for i,n in enumerate(S[::-1]): if n in keys: print(N-i) return print(0) main()