import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String s= in.next(); int c1=1; int c2=1; int c3=1; int c4=1; for(int i=0;i='0'&&s.charAt(i)<='9') c1=0; else if(s.charAt(i)>='a'&&s.charAt(i)<='z') c2=0; else if(s.charAt(i)>='A'&&s.charAt(i)<='Z') c3=0; 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)=='+') c4=0; } int k=s.length(); int ans=c1+c2+c3+c4; k=k+c1+c2+c3+c4; if(k<6){ ans=ans+6-k; } //System.out.println(c1+" "+c2+" "+c3+" "+c4); System.out.println(ans); } }