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) { boolean upperCase = false; boolean lowerCase = false; boolean length = false; boolean splC = false; boolean numC = false; String spl = "!@#$%^&*()-+"; String numbers = "0123456789"; String lower_case = "abcdefghijklmnopqrstuvwxyz"; String upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int c = 0; for(int i = 0; i < password.length(); i++){ for(int j = 0; j < numbers.length(); j++){ if(password.charAt(i) == numbers.charAt(j)){ numC = true; break; } } for(int j = 0; j < lower_case.length(); j++){ if(password.charAt(i) == lower_case.charAt(j)){ lowerCase = true; break; } } for(int j = 0; j < upper_case.length(); j++){ if(password.charAt(i) == upper_case.charAt(j)){ upperCase = true; break; } } for(int j = 0; j < spl.length(); j++){ if(password.charAt(i) == spl.charAt(j)){ splC = true; break; } } } if(!splC) c = c + 1; if(!upperCase) c = c + 1; if(!lowerCase) c = c + 1; if(!numC) c = c + 1; int len = password.length(); if(len >= 6){ return c; } else{ if(c + password.length() >= 6) return c; else{ //System.out.println(c); return c + 6 - (password.length() + c); } } } 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(); } }