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 num = false; boolean l = false; boolean u = false; boolean s = false; for (char c : password.toCharArray()) { if (!num && numbers.indexOf(c) >= 0) { num = true; } else if (!l && lower_case.indexOf(c) >= 0) { l = true; } else if (!u && upper_case.indexOf(c) >= 0) { u = true; } else if (!s && special_characters.indexOf(c) >= 0) { s = true; } } int count = 0; if (!num) { count++; } if (!l) { count++; } if (!u) { count++; } if (!s) { count++; } if (n + count < 6) { 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(); } }