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 hasLower = false; boolean hasUpper = false; boolean hasSpecial = false; boolean hasDigit = false; for(int i=0; i < password.length(); i++) { int charValue = (int)(password.charAt(i)); boolean notSpecial = false; if(charValue <= 122 && charValue >= 97) { hasLower = true; notSpecial = true; } if(charValue <= 90 && charValue >= 65) { hasUpper = true; notSpecial = true; } if(charValue <= 57 && charValue >= 48) { hasDigit = true; notSpecial = true; } if(!notSpecial) { hasSpecial = true; } } int numOfDigits = 6 - password.length(); int count = 0; if(!hasLower) { count++; } if(!hasUpper) { count++; } if(!hasSpecial) { count++; } if(!hasDigit) { count++; } int res = numOfDigits > count ? numOfDigits : count; return res; } 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(); } }