numbers = "0123456789" lower_case = "abcdefghijklmnopqrstuvwxyz" upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" special_characters = "!@#$%^&*()-+" n = int(input()) string = [str(i) for i in input()] boo_n = boo_l = boo_u = boo_s = False for i in range(n): if string[i] in numbers: boo_n = True if string[i] in lower_case: boo_l = True elif string[i] in upper_case: boo_u = True elif string[i] in special_characters: boo_s = True ans = 4 - (boo_l + boo_u + boo_s + boo_n) if 4-(boo_l + boo_u + boo_s + boo_n) + n >= 6 else 6 - n print(ans)