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[]) throws IOException { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String special_characters = "!@#$%^&*()-+"; int n = Integer.parseInt(in.readLine()); String s = in.readLine(); int index1 = -1; int index2 = -1; int index3 = -1; int index4 = -1; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (Character.isAlphabetic(c) && Character.isLowerCase(c)) { index1 = i; } if (Character.isAlphabetic(c) && Character.isUpperCase(c)) { index2 = i; } for (int j = 0; j < special_characters.length(); j++) { if (special_characters.charAt(j) == c) { index3 = i; break; } } if (Character.isDigit(c)) { index4 = i; } } int res = 0; if (index1 < 0) { res++; } if (index2 < 0) { res++; } if (index3 < 0) { res++; } if (index4 < 0) { res++; } System.out.println(Math.max(res, 6 - s.length())); } }