import bisect
n = int(input())
s = input()
idx = []
c = 0
for i in range(n):
    if s[i] in ["A","C","G","T"]:
        c += 1
        idx.append(i+1)

if c == 0:
    print(0)
    exit()

if c == idx[-1]:
    print(c)
elif c < idx[0]:
    print(idx[-1])
else:
    print(idx[-1]-idx[0]+1)