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 hasDigit = false; boolean lowerCase = false; boolean upperCase = false; boolean special = false; String spe = "!@#$%^&*()-+"; for (int i = 0; i < n; i++) { char c = password.charAt(i); if (Character.isDigit(c)) { hasDigit = true; } else if (c >= 'a' && c <= 'z') { lowerCase = true; } else if (c >= 'A' && c <= 'Z') { upperCase = true; } else if (spe.contains("" + c)) { special = true; } } int res = 0; if (!hasDigit) res++; if (!lowerCase) res++; if (!upperCase) res++; if (!special) res++; return Math.max(res, 6 - n); } 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(); } }