import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static Set numberSet = new HashSet<>(); static Set lowerSet = new HashSet<>(); static Set upperSet = new HashSet<>(); static Set specialSet = new HashSet<>(); static void buildCharSets(){ String numbers = "0123456789"; String lower_case = "abcdefghijklmnopqrstuvwxyz"; String upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; String special_characters = "!@#$%^&*()-+"; for(int i = 0; i < numbers.length(); i++){ numberSet.add(numbers.charAt(i)); } for(int i = 0; i < lower_case.length(); i++){ lowerSet.add(lower_case.charAt(i)); } for(int i = 0; i < upper_case.length(); i++){ upperSet.add(upper_case.charAt(i)); } for(int i = 0; i < special_characters.length(); i++){ specialSet.add(special_characters.charAt(i)); } } static int minimumNumber(int n, String password) { // Return the minimum number of characters to make the password strong int numcount = 0; int lowerCount = 0; int upperCount = 0; int specialCount = 0; int weakness = 0; for(int i = 0; i < password.length(); i++){ if(numberSet.contains(password.charAt(i))) numcount++; else if (lowerSet.contains(password.charAt(i))) lowerCount++; else if (upperSet.contains(password.charAt(i))) upperCount++; else specialCount++; } if (numcount < 1) weakness++; if (lowerCount < 1) weakness++; if (upperCount < 1) weakness++; if (specialCount < 1) weakness++; return Math.max((6-password.length()), weakness); } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String password = in.next(); buildCharSets(); int answer = minimumNumber(n, password); System.out.println(answer); in.close(); } }