N = int(input())
S = list(input())
ans = 0
for i in range(N):
    if S[i] in ["A", "G", "C", "T"]:
        ans = i + 1
print(ans)