import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import com.google.common.base.CharMatcher.*;

public class Solution {

    static int minimumNumber(int n, String password) {
        
        
        int cnt = 0;
        
        if(n<6)
        {
            cnt = (6-n);
            return cnt;
        }
        
        else{
        char ch;
        boolean upperFlag = false;
    boolean lowerCaseFlag = false;
    boolean numberFlag = false;
        
        for(int i=0;i < password.length();i++) {
        ch = password.charAt(i);
        if( Character.isDigit(ch)) {
            numberFlag = true;
        }
        else if (Character.isUpperCase(ch)) {
            upperFlag = true;
        } else if (Character.isLowerCase(ch)) {
            lowerCaseFlag = true;
        }
        
    }
        
        Pattern p = Pattern.compile("[^a-z0-9 ]", Pattern.CASE_INSENSITIVE);
        Matcher m = p.matcher(password);
     

            if (!m.find())
                cnt++;
        
        if(!numberFlag)
            cnt++;
        if(!upperFlag)
            cnt++;
        if(!lowerCaseFlag)
            cnt++;
        
        
       return cnt;
        }
    }

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