numbers = "0123456789" lower_case = "abcdefghijklmnopqrstuvwxyz" upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" special_characters = "!@#$%^&*()-+" n = int(input()) str = input() f1 = f2 = f3 = f4 = 0 for char in str: if char in numbers: f1 = 1 elif char in lower_case: f2 = 1 elif char in upper_case: f3 = 1 else: f4 = 1 print(max(6 - len(str),4-(f1+f2+f3+f4)))