#!/bin/python3 import sys import math def minimumNumber(n, password): # Return the minimum number of characters to make the password strong lower_case="a b c d e f g h i j k l m n o p q r s t u v w x y z" upper_case = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" special = "! @ # $ % ^ & * ( ) - +" total=0; if( not any(char.isdigit() for char in password)): total+=1 if (not any(char in list(special.split(" ")) for char in password)): total+=1 if (not any(char in list(upper_case.split(" ")) for char in password)): total+=1 if (not any(char in list(lower_case.split(" ")) for char in password)): total+=1 if(n<6): total+= max(6-n-total,0) return total if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)