n = int(input()) s = input() for i in range(n)[::-1]: if s[i] in 'AGCT': i += 1 break print(i)