numbers = "0123456789" lower_case = "abcdefghijklmnopqrstuvwxyz" upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" special_characters = "!@#$%^&*()-+" n=int(input()) a=input() f=[0]*4 ans=0 for i in a: if(i in numbers): f[0]=1 elif(i in lower_case): f[1]=1 elif(i in upper_case): f[2]=1 elif(i in special_characters): f[3]=1 print(max(6-len(a),4-sum(f)))