import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int minimumNumber(int n, String password) { // Return the minimum number of characters to make the password strong String numbers = "0123456789"; String lower_case = "abcdefghijklmnopqrstuvwxyz"; String upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; String special_characters = "!@#$%^&*()-+"; int n1 = (int)'0', n2 = (int)'9'; int l1 = (int)'a', l2=(int)'z'; int u1 = (int)'A', u2=(int)('Z'); Set sc = new HashSet(); for(char ch: special_characters.toCharArray()){ sc.add((int)ch); } boolean oDigit= false, oLowercase= false, oUpp= false, oSpec = false; for(char ch: password.toCharArray()){ int k = (int)ch; if(k>=n1 && k<=n2){ oDigit = true; } else if(k>=l1 && k<=l2){ oLowercase = true; }else if(k >= u1 && k<=u2){ oUpp = true; }else if(sc.contains(k)){ oSpec = true; } } int sum = (oDigit? 0:1) + (oLowercase? 0 : 1) + (oUpp ? 0 : 1) + (oSpec? 0 : 1); if(n + sum < 6){ return 6 - n; } return sum; } 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(); } }