import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { private static final String SPECIAL_CHARS = "!@#$%^&*()-+"; static int minimumNumber(int n, String password) { // Return the minimum number of characters to make the password strong int required = 4; boolean hasLowerCase = false; boolean hasUpperCase = false; boolean hasDigit = false; boolean hasSpecialChar = false; for(int i = 0; i < n; i++) { Character c = password.charAt(i); if(!hasLowerCase && Character.isLowerCase(c)) { required--; hasLowerCase = true; } else if(!hasUpperCase && Character.isUpperCase(c)) { required--; hasUpperCase = true; } else if(!hasDigit && Character.isDigit(c)) { required--; hasDigit = true; } else if(!hasSpecialChar && SPECIAL_CHARS.indexOf(c) != -1) { required--; hasSpecialChar = true; } } if(n < 6) { required = Math.max(6 - n, required); } return required; } 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(); } }