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 digit = false, lower= false, upper= false, special= false; for(int i = 0; i < password.length(); ++i) { char c = password.charAt(i); if(Character.isUpperCase(c)) upper = true; else if(Character.isLowerCase(c)) lower = true; else if(Character.isDigit(c)) digit = true; else if("!@#$%^&*()-+".indexOf(c) != -1) special = true; if(upper && lower && digit && special) break; } int count = 0; if(!upper) count++; if(!lower) count++; if(!digit) count++; if(!special) count++; return password.length()+count < 6 ? 6-password.length(): count; } 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(); } }