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 int charsToAdd = 0; if(n < 6) charsToAdd = 6 - n; int corrections = 0; boolean digit = false; boolean lower = false; boolean upper = false; boolean special = false; String numbers = "0123456789"; String lower_case = "abcdefghijklmnopqrstuvwxyz"; String upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; String special_characters = "!@#$%^&*()-+"; for(int i = 0; i < password.length(); i++){ if (numbers.indexOf(password.charAt(i)) != -1){ digit = true; continue; } if (lower_case.indexOf(password.charAt(i)) != -1){ lower = true; continue; } if (upper_case.indexOf(password.charAt(i)) != -1){ upper = true; continue; } if (special_characters.indexOf(password.charAt(i)) != -1){ special = true; continue; } if(digit && upper && lower && special){ break; } } if(!digit) corrections++; if(!lower) corrections++; if(!upper) corrections++; if(!special) corrections++; if(charsToAdd < corrections) charsToAdd = corrections; return charsToAdd; } 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(); } }