import java.util.Scanner; public class Solution { static int minimumNumber(int n, String password) { int chNeeded = (password.length() < 6) ? 6 - password.length() : 0; int isDigit = 0; int isLower = 0; int isUpper = 0; int isSpecial = 0; for (int i = 0; i < password.length(); i++) { if (Character.isDigit(password.charAt(i))) { isDigit = 1; } else if (Character.isLowerCase(password.charAt(i))) { isLower = 1; } else if (Character.isUpperCase(password.charAt(i))) { isUpper = 1; } else if (isSpecial(password.charAt(i))) { isSpecial = 1; } } int total = isDigit + isLower + isUpper + isSpecial; return (chNeeded > 4 - total ? chNeeded : 4 - total); } static boolean isSpecial(char ch) { if (ch == '!' || ch == '@' || ch == '#' || ch == '$' || ch == '%' || ch == '%' || ch == '^' || ch == '&' || ch == '*' || ch == '(' || ch == ')' || ch == '-' || ch == '+') { return true; } return false; } 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(); } }