import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static final String numbers = "0123456789"; static final String lower_case = "abcdefghijklmnopqrstuvwxyz"; static final String upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; static final String special_characters = "!@#$%^&*()-+"; static int minimumNumber(int n, String password) { // Return the minimum number of characters to make the password strong char[] a = password.toCharArray(); int typeCount = 0; boolean isNum = false, isUpper = false, isLower = false, isSpecial = false; for (char c: a) { if (numbers.indexOf(c) >= 0 && !isNum) { typeCount++; isNum = true; } if (lower_case.indexOf(c) >= 0 && !isLower) { typeCount++; isLower = true; } if (upper_case.indexOf(c) >= 0 && !isUpper) { typeCount++; isUpper = true; } if (special_characters.indexOf(c) >= 0 && !isSpecial) { typeCount++; isSpecial = true; } if (typeCount == 4){ break; } } return Math.max(6 - n, 4 - typeCount); } 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(); } }