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 password) { boolean hasUpper=false,hasLower=false,hasDigit=false,hasSpecial=false; String sp = "!@#$%^&*()-+"; int cnt=0; for(int i=0;i='0' && ch<='9'){ if(!hasDigit){ cnt++; } hasDigit = true; } else if(ch>='a' && ch<='z'){ if(!hasLower){ cnt++; } hasLower = true; } else if(ch>='A' && ch<='Z'){ if(!hasUpper){ cnt++; } hasUpper = true; } else if(sp.indexOf(ch)!= -1){ if(!hasSpecial){ cnt++; } hasSpecial = true; } } if(cnt>=4 && n>=6 ){ return 0; } else if(n>=6){ return 4-cnt; } else if(n<6) { return Math.max(4-cnt,6-n); } return 0; } 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(); } }