#!/bin/python import sys def minimumNumber(n, password): # Return the minimum number of characters to make the password strong numbers = list("0123456789") lower_case = list("abcdefghijklmnopqrstuvwxyz") upper_case = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") special_characters = list("!@#$%^&*()-+") num = 0 lower = 0 upper = 0 special = 0 for e in password: if e in numbers: num+=1 elif e in lower_case: lower+=1 elif e in upper_case: upper+=1 elif e in special_characters: special+=1 toadd = 0 if num==0: toadd+=1 if lower==0: toadd+=1 if upper==0: toadd+=1 if special==0: toadd+=1 if n+toadd<6: toadd = 6-n return toadd if __name__ == "__main__": n = int(raw_input().strip()) password = raw_input().strip() answer = minimumNumber(n, password) print answer