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 digit = false; boolean lower = false; boolean upper = false; boolean special = false; boolean foundAll = false; int i = 0; while (!foundAll && i < n) { char ch = password.charAt(i); if (0 <= ch - '0' && ch - '0' <= 9) { digit = true; } else if (0 <= ch - 'a' && ch - 'a' <= 26) { lower = true; } else if (0 <= ch - 'A' && ch - 'A' <= 26) { upper = true; } else if (ch == 33 || (35 <= ch && ch <= 38) ||(40 <= ch && ch <= 43) || ch == 45 || ch == 64 || ch == 94) { special = true; } i++; foundAll = digit && lower && upper && special; } int found = 0; if (digit) { found++; //System.out.println(" digit found "); } if (lower) { found++; //System.out.println(" lower found "); } if (upper) { found++; //System.out.println(" upper found"); } if (special) {found++; // System.out.println(" special found"); } //System.out.println(" found: " + found); int change = 0; if (n < 6) {change += 6-n;} return Math.max(change, 4-found); } 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(); } }