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) { boolean needsLower = true; boolean needsUpper = true; boolean needsDigit = true; boolean needsSpecial = true; int i = 0; while ((needsLower || needsUpper || needsDigit || needsSpecial) && i < n) { char ch = password.charAt(i++); if (ch >= 'a' && ch <= 'z') needsLower = false; else if (ch >= 'A' && ch <= 'Z') needsUpper = false; else if (ch >= '0' && ch <= '9') needsDigit = false; else needsSpecial = false; } int neededChars = 0; if (needsLower) neededChars++; if (needsUpper) neededChars++; if (needsDigit) neededChars++; if (needsSpecial) neededChars++; if (n < 6 && 6-n > neededChars) return 6-n; else return neededChars; } 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(); } }