import re def main(): _ = int(input()) s = input() if all((c not in s) for c in "AGCT"): exit(print(0)) # if re.search(r'[AGCT]+', s) is None: # print(0) res_iter = re.finditer(r"[AGCT]", s) print(max([x.start() + 1 for x in res_iter])) if __name__ == "__main__": main()