import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { private final static char[] numbers = "0123456789".toCharArray(); private final static char[] lower_case = "abcdefghijklmnopqrstuvwxyz".toCharArray(); private final static char[] upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray(); private final static char[] special_characters = "!@#$%^&*()-+".toCharArray(); private static boolean contains(char[] chars, char c) { for (int i = 0; i < chars.length; i++) { if (chars[i] == c) return true; } return false; } static int minimumNumber(int n, String password) { int a = Math.max(6 - password.length(), 0); int b = 0; for (int i = 0; i < password.length(); i++) { if (contains(numbers, password.charAt(i))) { b--; break; } } b++; for (int i = 0; i < password.length(); i++) { if (contains(lower_case, password.charAt(i))) { b--; break; } } b++; for (int i = 0; i < password.length(); i++) { if (contains(upper_case, password.charAt(i))) { b--; break; } } b++; for (int i = 0; i < password.length(); i++) { if (contains(special_characters, password.charAt(i))) { b--; break; } } b++; return Math.max(a, b); } 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(); } }