N = int(input()) S = input()[::-1] K = -1 for i in S: K += 1 if 'ACGT'.__contains__(i): print(N - K) exit(0) print(0)