n = int(input()) s = input() count = 0 sw = True if s.count("A") + s.count("G") + s.count("C") + s.count("T") == 0: print(0) sw = False while sw: x = s.count("A") + s.count("G") + s.count("C") + s.count("T") s = s[:x-1] + s[x:] x = x = s.count("A") + s.count("G") + s.count("C") + s.count("T") count += 1 if x == 0: print(count) sw = False