import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static final int length = 6; 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 int errLen = 0; if (password.length() < length) { errLen = length - password.length(); } int errHard = 4; boolean[] error = {true, true, true, true}; for (int i = 0; i < password.length(); i++) { String ch = "" + password.charAt(i); if (error[0]) { if (numbers.contains(ch)) { error[0] = false; errHard--; } } if (error[1]) { if (lower_case.contains(ch)) { error[1] = false; errHard--; } } if (error[2]) { if (upper_case.contains(ch)) { error[2] = false; errHard--; } } if (error[3]) { if (special_characters.contains(ch)) { error[3] = false; errHard--; } } } return Math.max(errLen, errHard); } 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(); } }