import java.util.Arrays; import java.util.Scanner; public class Solution { private static final char[] special = "!@#$%^&*()-+".toCharArray(); static int minimumNumber(int n, String password) { boolean hasUpper, hasLower, hasDigit, hasSpecial = hasDigit = hasLower = hasUpper = false; int count = 4; for (int i = 0; i < n; i++) { char c = password.charAt(i); if (!hasSpecial && Arrays.binarySearch(special, c) >= 0) { hasSpecial = true; count--; } if (!hasLower && Character.isLowerCase(c)) { hasLower = true; count--; } if (!hasUpper && Character.isUpperCase(c)) { hasUpper = true; count--; } if (!hasDigit && Character.isDigit(c)) { count--; hasDigit = true; } } return n < 6 ? (Math.max(6 - n, count)) : count; // Return the minimum number of characters to make the password strong } public static void main(String[] args) { Arrays.sort(special); 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(); } }