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 numbers = "0123456789"; String lowerCase = "abcdefghijklmnopqrstuvwxyz"; String upperCase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; String specialCharacters = "!@#$%^&*()-+"; int minLength = 6; int lengthLeft = 6 - n; boolean numberBln = false; boolean lowerCaseBln = false; boolean upperCaseBln = false; boolean specialCharactersBln = false; int counter = 0; for(int i = 0; i < password.length(); i++){ if(numbers.indexOf(password.charAt(i)) != -1){ numberBln = true; } else if(lowerCase.indexOf(password.charAt(i)) != -1){ lowerCaseBln = true; } else if(upperCase.indexOf(password.charAt(i)) != -1){ upperCaseBln = true; } else if(specialCharacters.indexOf(password.charAt(i)) != -1){ specialCharactersBln = true; } if(numberBln && lowerCaseBln && upperCaseBln && specialCharactersBln) break; } if(!numberBln)counter++; if(!lowerCaseBln)counter++; if(!upperCaseBln)counter++; if(!specialCharactersBln)counter++; return Math.max(lengthLeft, counter); } 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(); } }