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) { char[] ar = password.toCharArray(); char[] numbers = "0123456789".toCharArray(); //lower_case = "abcdefghijklmnopqrstuvwxyz" //upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" char[] special_characters = "!@#$%^&*()-+".toCharArray(); boolean[] satisfy = new boolean[4]; Arrays.fill(satisfy, false); for(int i = 0; i < ar.length; i++){ for(int j = 0; j < numbers.length; j++){ if(numbers[j] == ar[i]){ satisfy[0] = true; //System.out.println("number"); break; } } if(Character.isLowerCase(ar[i])) satisfy[1] = true; if(Character.isUpperCase(ar[i])) satisfy[2] = true; for(int j = 0; j < special_characters.length; j++){ if(special_characters[j] == ar[i]){ satisfy[3] = true; //System.out.println("special"); break; } } } int count = 0; for(int j = 0; j < satisfy.length; j++){ if(!satisfy[j]) count++; } if(n < 6){ if(count + n < 6) count = 6 - n; } return count; } 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(); } }