import re n = int(input()) s = input() if not(n==len(s) and re.match(r'^[A-Z]*$', s)!=None): exit() result = re.match(r'^.*(A|G|C|T)', s) if result==None: print(0) else: print(result.end())