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 s) { int num=0,low=0,high=0,spec=0; // Return the minimum number of characters to make the password strong for(int i=0;i='0' && s.charAt(i)<='9') num=1; else if(s.charAt(i)>='a' && s.charAt(i)<='z') low=1; else if(s.charAt(i)>='A' && s.charAt(i)<='Z') high=1; else if(s.charAt(i)=='!' || s.charAt(i)=='@'|| s.charAt(i)=='#'|| s.charAt(i)=='$'|| s.charAt(i)=='%'|| s.charAt(i)=='^'|| s.charAt(i)=='&'|| s.charAt(i)=='*'|| s.charAt(i)=='('|| s.charAt(i)==')'|| s.charAt(i)=='-'|| s.charAt(i)=='+' ) spec=1; } int count=0; if(num==1) count++; if(low==1) count++; if(high==1) count++; if(spec==1) count++; int nu=0; if(n<6 ) nu=6-n; count=4-count; if(nu>count) return nu; else return count; } 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(); } }