#!/bin/python3

import sys

def minimumNumber(n, password):
    # Return the minimum number of characters to make the password strong
    ch=0
    lc=0
    uc=0
    d=0
    sum = 0
    numbers = "0123456789"
    lower_case = "abcdefghijklmnopqrstuvwxyz"
    upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    special_characters = "!@#$%^&*()-+"
    for i in password:
        if(i in numbers):
            d += 1
        if(i in lower_case):
            lc += 1
        if(i in upper_case):
            uc +=1
        if(i in special_characters):
            ch +=1
    sum += ch + lc + uc + d
    count = 0
    flag = [ch,d,uc,lc]
    for i in flag:
        if(i==0):
            count +=1
    total=count+sum
    if(total<6):
        return 6-total+count
    else:
        return count
        
            

if __name__ == "__main__":
    n = int(input().strip())
    password = input().strip()
    answer = minimumNumber(n, password)
    print(answer)