import java.io.*; import java.util.*; public class StrongPassword { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = Integer.parseInt(in.nextLine()); String password = in.next(); int answer = minimumNumber(n, password); System.out.println(answer); in.close(); } static int minimumNumber(int n, String password) { String[] caseStrings = {"0123456789", "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "!@#$%^&*()-+"}; // Return the minimum number of characters to make the password strong //length int len = 0; if(password.length() < 6) { len = 6 - password.length(); //num to add if too sthort } int reqs = 4; //check for cases boolean[] cases = new boolean[4]; //in order nums, lower, upper, special for(int i = 0; i < password.length(); i++) { char c= password.charAt(i); for(int j = 0; j < 4; j++) { if(!cases[j]) { if(caseStrings[j].contains(c+"")) { cases[j] = true; reqs--; } } } } return Math.max(len, reqs); } }