import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int minimumNumber(int n, String p) { // Return the minimum number of characters to make the password strong int sln=0,dn=0,cn=0,sn=0,i; char []c=p.toCharArray(); for(i=0;i=97 && c[i]<123){ sn++; } else if(c[i]>=65 && c[i]<=90) cn++; else if(c[i]>='0' && c[i]<='9') dn++; else if(c[i]=='!' || c[i]=='@'||c[i]=='#'||c[i]=='$'||c[i]=='%'||c[i]=='^'||c[i]=='&'||c[i]=='*'||c[i]==40||c[i]==41||c[i]=='-'||c[i]=='+' ) sln++; if(sln>0 && sn>0 && dn>0 && cn>0) i=n; } int an=0; if(sn==0) an++; if(sln==0) an++; if(dn==0) an++; if(cn==0) an++; if(n<6){ int x=6-n; if(x>an) an=x; } return an; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String password = in.next(); int answer = minimumNumber(n, password); System.out.println(answer); in.close(); } }