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) { // Return the minimum number of characters to make the password strong char []c=password.toCharArray(); int p=4,flagn=0,flags=0,flagb=0,flagx=0; for(int i=0;i='0'&&c[i]<='9') { if(flagn==0) { p--; flagn=1; } } else if(c[i]>='a'&&c[i]<='z') { if(flags==0) { p--; flags=1; } } else if(c[i]>='A'&&c[i]<='Z') { if(flagb==0) { p--; flagb=1; } } else { if(flagx==0) { p--; flagx=1; } } } if(n<6) { if(n+p>=6) return p; else return (6-n); } return p; } 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(); } }