import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution {

    private static final int MIN_LNGTH = 6;
    
    private static String numbers = "0123456789";
    private static String lower_case = "abcdefghijklmnopqrstuvwxyz";
    private static String upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    private static String special_characters = "!@#$%^&*()-+";
        
    private static boolean digit = false;
    private static boolean lower = false;
    private static boolean upper = false;
    private static boolean spec = false;
    
    static int minimumNumber(int n, String password) {
        // Return the minimum number of characters to make the password strong
        if(password.length() < MIN_LNGTH)
            return MIN_LNGTH - password.length();
        
        for(int i=0; i < password.length(); i++) {
            if(!digit) {
                for(int j=0; j < numbers.length(); j++) {
                    if(password.charAt(i) == numbers.charAt(j)){
                        digit = true;
                        break;
                    }
                }
            }
            
            if(!lower) {
                for(int j=0; j < lower_case.length(); j++) {
                    if(password.charAt(i) == lower_case.charAt(j)){
                        lower = true;
                        break;
                    }
                }
            }
            if(!upper) {
                for(int j=0; j < upper_case.length(); j++) {
                    if(password.charAt(i) == upper_case.charAt(j)){
                        upper = true;
                        break;
                    }
                }
            }
            if(!spec) {
                for(int j=0; j < special_characters.length(); j++) {
                    if(password.charAt(i) == special_characters.charAt(j)){
                        spec = true;
                        break;
                    }
                }
           }
            
            if(digit && lower && upper && spec)
                return 0;
        }
        
        int count = 0;
        if(!digit) count++;
        if(!lower) count++;
        if(!upper) count++;
        if(!spec) count++;
        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();
    }
}