using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Solution {

    static int minimumNumber(int n, string password) {
        // Return the minimum number of characters to make the password strong
        string numbers = "0123456789";
        string lowerCase = "abcdefghijklmnopqrstuvwxyz";
        string upperCase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        string specialChar = "!@#$%^&*()-+";
        int count = 4;
        int len = 6;
        if(password.Length<6){
            len-=password.Length;
        }
        else len = 0;
        for(int i = 0; i<password.Length; i++){
            if(numbers.Contains(password[i])){
                count--;
                break;
            }
        }
               for(int i = 0; i<password.Length; i++){
            if(lowerCase.Contains(password[i])){
                count--;
                break;
            }
        }
               for(int i = 0; i<password.Length; i++){
            if(upperCase.Contains(password[i])){
                count--;
                break;
            }
        }
          for(int i = 0; i<password.Length; i++){
            if(specialChar.Contains(password[i])){
                count--;
                break;
            }
        }
        
        if(count>len) return count;
        return len;
               
    }

    static void Main(String[] args) {
        int n = Convert.ToInt32(Console.ReadLine());
        string password = Console.ReadLine();
        int answer = minimumNumber(n, password);
        Console.WriteLine(answer);
    }
}