t=int(input()) s=input() s=[i for i in s] numbers = "0123456789" lower_case = "abcdefghijklmnopqrstuvwxyz" upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" special_characters = "!@#$%^&*()-+" c=0 if not any(i in s for i in numbers): c+=1 if not any(i in s for i in lower_case): c+=1 if not any(i in s for i in upper_case): c+=1 if not any(i in s for i in special_characters): c+=1 print(6-(len(s)) if c <6-len(s) else c)