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 str) { // Return the minimum number of characters to make the password strong boolean[] a=new boolean[4]; String s="!@#$%^&*()-+"; char[] sp=s.toCharArray(); for(int i=0;i<n;i++){ if(str.charAt(i)>=48 && str.charAt(i)<=57) a[0]=true; else if(str.charAt(i)>=97 && str.charAt(i)<=122) a[1]=true; else if(str.charAt(i)>=65 && str.charAt(i)<=90) a[2]=true; else{ for(int j=0;j<12;j++){ if(str.charAt(i)==sp[j]) a[3]=true; } } } int count=0; for(int i=0;i<4;i++){ if(!a[i]) count++; } int len=str.length(); len+=count; if(len<6) count+=(6-len); return count; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt();in.nextLine(); String password = in.nextLine(); int answer = minimumNumber(n, password); System.out.println(answer); in.close(); } }