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) { int res=Math.max(0, 6-n); boolean[] ok=new boolean[4]; for (char ch : password.toCharArray()) { if ("0123456789".indexOf(ch) >=0)ok[0]=true; else if("abcdefghijklmnopqrstuvwxyz".indexOf(ch) >=0)ok[1]=true; else if("ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(ch) >=0)ok[2]=true; else if("!@#$%^&*()-+".indexOf(ch) >=0)ok[3]=true; } int miss=0; for (int i=0;i<4;++i)if (!ok[i])++miss; return Math.max(res, miss); } 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(); } }