import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int n= sc.nextInt(); char[] arr= sc.next().toCharArray(); int upper=0, lower=0,number=0,sp=0; int sum=0; for (int i = 0; i ='a'){lower++;} else if (arr[i]<='9'&&arr[i]>='0'){number++;} else if (arr[i]<='Z'&&arr[i]>='A'){upper++;} else{sp++;} } if(n>=6){ if(lower==0)sum++; if(upper==0)sum++; if(number==0)sum++; if(sp==0)sum++; } else{ if(lower==0)sum++; if(upper==0)sum++; if(number==0)sum++; if(sp==0)sum++; if(sum+n<6)sum=(6-n); } System.out.print(sum); } }