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 special_characters = "!@#$%^&*()-+"; int[] flags = new int[4]; HashSet set = new HashSet<>(); for(int i = special_characters.length() - 1; i >= 0; --i){set.add(special_characters.charAt(i));} char ch = ' '; for(int i = 0; i < n; ++i){ ch = password.charAt(i); if('0' <= ch && ch <= '9'){ flags[0] |= 1; }else if('a' <= ch && ch <= 'z'){ flags[1] |= 1; }else if('A' <= ch && ch <= 'Z'){ flags[2] |= 1; }else if(set.contains(ch)){ flags[3] |= 1; } } int sum = 0; for(int i = 0; i < 4; ++i) sum += flags[i]; sum = 4 - sum + n; return Math.max(6 - n, sum - n); } 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(); } }