import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static String numbers = "0123456789"; static String lower_case = "abcdefghijklmnopqrstuvwxyz"; static String upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; static String special_characters = "!@#$%^&*()-+"; static int minimumNumber(int n, String password) { // Return the minimum number of characters to make the password strong int res = 0; int countNum = 0; int countLow = 0; int countUp = 0; int countSpec = 0; for (int i = 0; i< password.length(); i++ ){ if (numbers.indexOf(password.charAt(i))>=0) countNum=1; else if (lower_case.indexOf(password.charAt(i))>=0) countLow=1; else if (upper_case.indexOf(password.charAt(i))>=0) countUp=1; else if (special_characters.indexOf(password.charAt(i))>=0) countSpec=1; } int need = 4 - (countNum + countLow+ countUp + countSpec); res = 6 - password.length() + need; if (password.length()<6){ /*if () return 6 - password.length(); else return ;*/ return Math.max(6-password.length(), need); } else return need; } 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(); } }