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 = "!@#$%^&*()-+"; boolean b1=false,b2=false,b3=false,b4=false; for(char c : password.toCharArray()){ if(numbers.indexOf(c) != -1) b1=true; if(lower_case.indexOf(c) != -1) b2=true; if(upper_case.indexOf(c) != -1) b3=true; if(special_characters.indexOf(c) != -1) b4=true; } int changes = 0; if(!b1) ++changes; if(!b2) ++changes; if(!b3) ++changes; if(!b4) ++changes; changes = Math.max(changes,6-password.length()); return changes; } 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(); } }