N = int(input())
S = list(input())
ans = -1

for i in range(N):
    if S[i] in "AGCT":
        ans = i

print(ans + 1)