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) { // Return the minimum number of characters to make the password strong boolean digit = false, lower = false, upper = false, special = false; for(int i = 0; i < n; i++){ if(password.charAt(i) <= 'z' && password.charAt(i) >= 'a') lower = true; else if(password.charAt(i) <= 'Z' && password.charAt(i) >= 'A') upper = true; else if(password.charAt(i) <= '9' && password.charAt(i) >= '0') digit = true; else{ switch(password.charAt(i)){ case '!': case '@': case '#': case '$': case '%': case '^': case '&': case '*': case '(': case ')': case '-': case '+': special = true; break; } } } int count = 0; if(lower) count++; if(upper) count++; if(digit) count++; if(special) count++; int res = 4 - count; if(res + n < 6) res += 6 - res - n; 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(); } }