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) { String numbers = "0123456789"; String lower_case = "abcdefghijklmnopqrstuvwxyz"; String upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; String special_characters = "!@#$%^&*()-+"; boolean[] has = new boolean[4]; for (int i = 0; i < n && !(has[0] && has[1] && has[2] && has[3]); i++) { String c = "" + password.charAt(i); if (numbers.contains(c)) { has[0] = true; } else if (lower_case.contains(c)) { has[1] = true; } else if (upper_case.contains(c)) { has[2] = true; } else if (special_characters.contains(c)) { has[3] = true; } } int count = 0; for (boolean b : has) { if (!b) { count++; } } if (n <= 2) { return 6 - n; } else if (n < 6) { return Math.max(count, 6-n); } return count; } 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(); } }