import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Solution { static int minimumNumber(int n, String password) { // Return the minimum number of characters to make the password strong int l=0,k=0; if (password.length() < 6) { l = 6 - password.length(); } if (!Pattern.compile("[0-9]+").matcher(password).find()) { k++; } if (!Pattern.compile("[a-z]+").matcher(password).find()) { k++; } if (!Pattern.compile("[A-Z]+").matcher(password).find()) { k++; } if (!Pattern.compile("[^A-Za-z0-9]").matcher(password).find()) { k++; } if (k <= l) return l; else if (k > l) return k; else return n; } 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(); } }