#!/bin/python3

import math
import os
import random
import re
import sys

#
# Complete the 'minimumNumber' function below.
#
# The function is expected to return an INTEGER.
# The function accepts following parameters:
#  1. INTEGER n
#  2. STRING password
#
numbers = "0123456789"
lower_case = "abcdefghijklmnopqrstuvwxyz"
upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
special_characters = "!@#$%^&*()-+"
listOfCases = [0,0,0,0]
def minimumNumber(n, password):
    # Return the minimum number of characters to make the password strong
    for i in password: 
        if i in numbers :
            listOfCases[0]+=1
        elif i in lower_case:
            listOfCases[1]+=1
        elif i in upper_case : 
            listOfCases[2]+=1
        elif i in special_characters:
            listOfCases[3]+=1
    
    count = 0 
    for j in listOfCases:
        if j==0:
            count+=1
    
    if n >=6 : 
        return count
    else: 
        return max((6-n),count)
        
                
            

if __name__ == '__main__':
    fptr = open(os.environ['OUTPUT_PATH'], 'w')

    n = int(input().strip())

    password = input()

    answer = minimumNumber(n, password)

    fptr.write(str(answer) + '\n')

    fptr.close()
