import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { private static final int INTEGER = 0; private static final int LOWER = 1; private static final int UPPER = 2; private static final int SPECIAL = 3; private static final String SPECIAL_STRING = "!@#$%^&*()-+"; private static final String NUMBERS = "0123456789"; private static final boolean[] HAS_ARRAY = new boolean[4]; static int minimumNumber(int n, String password) { for (char ch : password.toCharArray()) { if (ch >= 'a' && ch <= 'z' && !HAS_ARRAY[LOWER]) { HAS_ARRAY[LOWER] = true; } else if (ch >= 'A' && ch <= 'Z' && !HAS_ARRAY[UPPER]) { HAS_ARRAY[UPPER] = true; } else if (SPECIAL_STRING.indexOf(ch) > -1) { HAS_ARRAY[SPECIAL] = true; } else if (NUMBERS.indexOf(ch) > -1) { HAS_ARRAY[INTEGER] = true; } } int toAdd = 4; for (boolean has : HAS_ARRAY) { if (has) { --toAdd; } } return Math.max(6 - password.length(), toAdd); } 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(); } }