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) { String numbers = "0123456789"; String lower_case = "abcdefghijklmnopqrstuvwxyz"; String upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; String special_characters = "!@#$%^&*()-+"; int needed = 0; boolean got = false; for(int i = 0; i < n; i++) { for(char ch : numbers.toCharArray()) { if(password.charAt(i) == ch) { got = true; break; } } } if(got) needed++; got = false; for(int i = 0; i < n; i++) { for(char ch : lower_case.toCharArray()) { if(password.charAt(i) == ch) { got = true; break; } } } if(got) needed++; got = false; for(int i = 0; i < n; i++) { for(char ch : upper_case.toCharArray()) { if(password.charAt(i) == ch) { got = true; break; } } } if(got) needed++; got = false; for(int i = 0; i < n; i++) { for(char ch : special_characters.toCharArray()) { if(password.charAt(i) == ch) { got = true; break; } } } if(got) needed++; int extra = 4 - needed; if(n + extra < 6) { extra += 6 - (n + extra); } return extra; } 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(); } }