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 String numbers = "0123456789"; String lower_case = "abcdefghijklmnopqrstuvwxyz"; String upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; String special_characters = "!@#$%^&*()-+"; int R = 4; String[] req = new String[R]; req[0] = numbers; req[1] = lower_case; req[2] = upper_case; req[3] = special_characters; boolean[] satisfy = new boolean[R]; for (int i = 0; i < n; i++) { char c = password.charAt(i); for (int j = 0; j < R; j++) { if (satisfy[j]) continue; if (req[j].indexOf(c) >= 0) { satisfy[j] = true; break; } } } int cnt = 0; for (boolean sa : satisfy) if (!sa) cnt++; return Math.max(cnt, 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(); } }