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) { // Return the minimum number of characters to make the password strong // numbers = "0123456789"; // lower_case = "abcdefghijklmnopqrstuvwxyz"; // upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; // special_characters = "!@#$%^&*()-+";//33 100 35 36 37 38 94 40 41 45 43 int ret = 4; boolean containDig= false, containUp=false, containLow=false, containSp=false; for(int i =0 ; i < n; i++){ if(!containDig && password.charAt(i) >47 && password.charAt(i)<58){ //is digit containDig = true; ret--; }else if(!containUp && password.charAt(i) >64 && password.charAt(i)<91){ //us upper containUp = true; ret--; }else if(!containLow && password.charAt(i) >96 && password.charAt(i)<123){ //is lower containLow = true; ret--; } else if(!containSp && password.charAt(i) >32 && password.charAt(i)<46){ if(password.charAt(i) !=34 && password.charAt(i) !=39 && password.charAt(i) !=42 && password.charAt(i) !=44){ //is sp containSp = true; ret--; } }else if(!containSp && password.charAt(i) ==100 && password.charAt(i) ==94){ //is sp containSp = true; ret--; } } if(n >= 6){ return ret; }else{ int contain = 4 - ret; int dif = 6- n; if(dif >= ret){ return dif; }else{ return ret; } } } 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(); } }