#!/bin/python import sys def minimumNumber(n, password): # Return the minimum number of characters to make the password strong l=list(password) numbers = list("0123456789") lower_case = list("abcdefghijklmnopqrstuvwxyz") upper_case = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") special_characters = list("!@#$%^&*()-+") c1=0 c2=0 c3=0 c4=0 for i in l: if(i in numbers): c1+=1 elif(i in lower_case): c2+=1 elif(i in upper_case): c3+=1 elif(i in special_characters): c4+=1 c=0 if(c1>0 and c2>0 and c3>0 and c4>0 and len(l)>=6): return 0 else: if(c1==0):c+=1 if(c2==0):c+=1 if(c3==0):c+=1 if(c4==0):c+=1 if(len(l)>=6): return c else: if(c>6-len(l)): return c else: return 6-len(l) if __name__ == "__main__": n = int(raw_input().strip()) password = raw_input().strip() answer = minimumNumber(n, password) print answer