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) { // Return the minimum number of characters to make the password strong String numbers = "0123456789"; String lower_case = "abcdefghijklmnopqrstuvwxyz"; String upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; String special_characters = "!@#$%^&*()-+"; int res = 6 - n; boolean d = false; boolean l = false; boolean u = false; boolean s = false; for (int i = 0; i < password.length(); i++) { char cur = password.charAt(i); if (d == false && cur >= 48 && cur <= 57) { d = true; } if (l == false && cur >= 65 && cur <= 90) { l = true; } if (u == false && cur >= 97 && cur <= 122) { u = true; } if (s == false && special_characters.indexOf(cur) >= 0) { s = true; } } int temp = 0; if (d == false) { temp++; } if (l == false) { temp++; } if (u == false) { temp++; } if (s == false) { temp++; } return Math.max(temp, res); } 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(); } }