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
		char pword[] = password.toCharArray();
		char schar[] = { '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-',
				'+' };
		int count = 0;
        int sfound = 0;
		for (int i = 0; i < schar.length; i++) {
			if (password.contains(Character.toString(schar[i]))) {
				sfound++;
				break;
			}
		}
		int dfound = 0;
		int lfound = 0;
		int ufound = 0;
		for (int i = 0; i < pword.length; i++) {
			if (dfound == 0 && Character.isDigit(pword[i])) {
				dfound++;
			}
			if (lfound == 0 && Character.isLowerCase(pword[i])) {
				lfound++;
			}
			if (ufound == 0 && Character.isUpperCase(pword[i])) {
				ufound++;
			}

		}
		
		if (dfound == 0) {
			count++;
		}
		if (lfound == 0) {
			count++;
		}
		if (ufound == 0) {
			count++;
		}
		if(sfound == 0)
		{
			count++;
		}
		
		if(n<6 && (count+n) < 6)
		{
			count = count + (6-(count+n));
		}
		
		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();
    }
}