import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); char[] s = sc.next().toCharArray(); sc.close(); for (int i = n - 1; i >= 0; i--) { if (s[i] == 'A' || s[i] == 'G' || s[i] == 'C' || s[i] == 'T') { System.out.println(i + 1); return; } } System.out.println(0); } }