using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static long[] LList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => long.Parse(ReadLine())).ToArray(); public static void Main() { Solve(); } static void Solve() { var n = NN; var s = ReadLine(); WriteLine(new int[] { s.LastIndexOf('A'), s.LastIndexOf('G'), s.LastIndexOf('C'), s.LastIndexOf('T') }.Max() + 1); } }