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) {
        // Return the minimum number of characters to make the password strong
        
        boolean isDigitPresent = false;
        boolean isLowerPresent = false;
        boolean isUpperPresent = false;
        boolean isSpecialPresent = false;
        int count = 0;
        
        for(int i=0; i<n ; i++){
            char pass = password.charAt(i);
            int passAscii = (int) pass;
            
            if(passAscii >=48 && passAscii <= 57){
                isDigitPresent = true;
            }
            if(passAscii >=97 && passAscii <= 122){
                isLowerPresent = true;
            }
            if(passAscii >=65 && passAscii <= 90){
                isUpperPresent = true;
            }
            if(pass == '!' || pass == '@' || pass == '#' || pass == '$' || pass == '%' || pass == '^' || pass == '&' || pass == '*' || pass == '(' || pass == ')' || pass == '-' || pass == '+'){
                isSpecialPresent = true;
            }
            
        }
        
        int ans = 0;
            
            int requiredLength = 0;
            if(n<6){
            requiredLength = n + (6-n);
                
            }
            
            if(!isDigitPresent){
                count++;
            }
            if(!isLowerPresent){
                count++;
            }
            if(!isUpperPresent){
                count++;
            }
            if(!isSpecialPresent){
                count++;
            }

            int reqC = count;

            
            if(n<6){
                int sumofreq = reqC+n;
                int diffofreq = 6-sumofreq;
                if((sumofreq) >= 6){
                    ans = reqC;

                }
                else{
                    ans = reqC + diffofreq;

                }
            }
            else{
                ans = reqC;

            }
            
            
        return ans;
    }

    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();
    }
}