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) { Pattern p = Pattern.compile("(?[!@#$%^&*()\\-+]+)|(?[a-z]+)|(?[A-Z]+)|(?\\d+)"); Matcher m = p.matcher(password); boolean[] set = new boolean[4]; while (m.find()) { set[0] = set[0] || m.group("spec") != null; set[1] = set[1] || m.group("low") != null; set[2] = set[2] || m.group("high") != null; set[3] = set[3] || m.group("dig") != null; } int count = 4; for (int i = 0; i< 4; i++) { if (set[i]) count--; } if (password.length() >= 6) { return count; } else { int v = 6 - password.length(); if (v >= count) { return v; } else { 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(); } }