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) { boolean needsUpper = true; boolean needsLower = true; boolean needsDigit = true; boolean needsSpecial = true; String special_characters = "!@#$%^&*()-+"; for(int i = 0; i < n; i++) { if(needsUpper && password.charAt(i) >= 'A' && password.charAt(i) <= 'Z') {needsUpper = false;} if(needsLower && password.charAt(i) >= 'a' && password.charAt(i) <= 'z') {needsLower = false;} if(needsDigit && password.charAt(i) >= '0' && password.charAt(i) <= '9') {needsDigit = false;} if(needsSpecial && special_characters.contains("" + password.charAt(i))) {needsSpecial = false;} } int errors = (needsUpper? 1 : 0) + (needsLower? 1 : 0) + (needsDigit? 1 : 0) + (needsSpecial? 1 : 0); return Math.max(errors, 6-n); } 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(); } }