import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static boolean checkDigits(char c) { if(c >= '0' && c <= '9') return true; return false; } static boolean checkLower(char c) { if(c >= 'a' && c <= 'z') return true; return false; } static boolean checkUpper(char c) { if(c >= 'A' && c <= 'Z') return true; return false; } static int minimumNumber(int n, String password) { boolean lowerCase = false; boolean upperCase = false; boolean digits = false; boolean special = false; for(int i = 0; i < n; i++) { if(lowerCase && upperCase && digits && special){ if(n >= 6) return 0; else return(6 - n); } char c = password.charAt(i); if(checkDigits(c)) digits = true; else if(checkLower(c)) lowerCase = true; else if(checkUpper(c)) upperCase = true; else special = true; } int count = 0; if(!lowerCase) count++; if(!upperCase) count++; if(!digits) count++; if(!special) count++; if((n+count) >= 6) return count; return 6-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(); } }