import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashSet; public class StrongPassword { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static ArrayList> list; static HashSet hs; static ArrayList tmp; public static void main(String[] args) throws java.lang.Exception { int n = Integer.parseInt(br.readLine()); int d,l,u,sp; d=l=u=sp=1; String s=br.readLine(); for(int i=0;i='A' && ch<='Z') u=0; else if(ch>='a' && ch<='z') l=0; else if(ch>='0' && ch<='9') d=0; else sp=0; } int ans=Math.max(6-n,d+l+u+sp); System.out.println(ans); } }