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) { int total = 0; String numbers = "0123456789"; String lc = "abcdefghijklmnopqrstuvwxyz"; String uc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; String sc = "!@#$%^&*()-+"; boolean num_check = false; boolean lc_check = false; boolean uc_check = false; boolean sc_check = false; for (int i = 0; i < n; i++){ for (int j = 0; j < numbers.length(); j++){ if (password.charAt(i) == numbers.charAt(j)){ num_check = true; break; } } for (int j = 0; j < lc.length(); j++){ if (password.charAt(i) == lc.charAt(j)){ lc_check = true; break; } } for (int j = 0; j < uc.length(); j++){ if (password.charAt(i) == uc.charAt(j)){ uc_check = true; break; } } for (int j = 0; j < sc.length(); j++){ if (password.charAt(i) == sc.charAt(j)){ sc_check = true; break; } } } if (!num_check){ total++; } if (!lc_check){ total++; } if (!uc_check){ total++; } if (!sc_check){ total++; } if (n + total < 6){ return 6 - n; } return total; } 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(); } }