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 String spl = "!@#$%^&*()-+"; int retVal = 0; boolean digitFound = false; boolean upFound = false; boolean loFound = false; boolean splFound = false; if(n < 6) { return 6 - n; } for(int i = 0; i < n; i++) { if(Character.isDigit(password.charAt(i))) { digitFound = true; } if(Character.isUpperCase(password.charAt(i))) { upFound = true; } if(Character.isLowerCase(password.charAt(i))) { loFound = true; } if(spl.indexOf(password.charAt(i)) != -1){ splFound = true; } } if(!digitFound) { retVal++; } if(!upFound) { retVal++; } if(!loFound) { retVal++; } if(!splFound) { retVal++; } return retVal; } 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(); } }