#!/bin/python3 import sys def minimumNumber(n, password): # Return the minimum number of characters to make the password strong a=0 b=0 for i in password: if(i.isdigit()==True): b=1 if(b==0): a+=1 b=0 for i in password: if(i.islower()==True): b=1 if(b==0): a+=1 b=0 for i in password: if(i.isupper()==True): b=1 if(b==0): a+=1 b=0 for i in password: if(i=='#' or i=='+' or i=='-' or i=='(' or i==')' or i=='$' or i=='!' or i=='@' or i=='%' or i=='^' or i=='&' or i=='*' ): b=1 if(b==0): a+=1 if(n+a>=6): return(a) else: return(6-n) if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)