import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { private static final String numbers = "0123456789"; private static final String lower_case = "abcdefghijklmnopqrstuvwxyz"; private static final String upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; private static final String special_characters = "!@#$%^&*()-+"; private static int minimumNumber(int n, String password) { boolean hasNumbers = false, hasLower = false, hasUpper = false, hasSpecial = false; for (int i = 0; i < password.length(); i++) { final String s = String.valueOf(password.charAt(i)); if (numbers.contains(s)) { hasNumbers = true; } else if (lower_case.contains(s)) { hasLower = true; } else if (upper_case.contains(s)) { hasUpper = true; } else if (special_characters.contains(s)) { hasSpecial = true; } } int toAdd = (hasNumbers ? 0 : 1) + (hasLower ? 0 : 1) + (hasUpper ? 0 : 1) + (hasSpecial ? 0 : 1); 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(); } }