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) { if(n<=3) return 6-n; else { int flag_lc=1; int flag_uc=1; int flag_digit=1; int flag_special=1; char ch[]=new char[n]; ch=password.toCharArray(); for(char c : ch) { int temp =(int) c; if(temp>=48 && temp<=57) { flag_digit=0; } if(temp>=65 && temp<=90) { flag_uc=0; } if(temp>=97 && temp<=122) { flag_lc=0; } if(c=='!' ||c=='@' ||c=='#' ||c=='$' ||c=='%' ||c=='^' ||c=='&' ||c=='*' ||c=='(' ||c==')' ||c=='-' ||c=='+') flag_special=0; } return flag_lc+flag_uc+flag_digit+flag_special; } } 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); if(n+answer<=6) { answer=6-n; } System.out.println(answer); in.close(); } }