n = int(input()) s = list(input()) cnt = 0 S = set(["A","G","C","T"]) s.reverse() idx = -1 for i, d in enumerate(s): if d in S: idx = i break if idx == -1: print(0) else: print(n-i)