#!/bin/python3 import sys def minimumNumber(n, password): # Return the minimum number of characters to make the password strong l_num=0 l_low=0 l_upp=0 l_special=0 count=0 l_diff=n-6 for i in password: if i in "0123456789": l_num=1 if i in "abcdefghijklmnopqrstuvwxyz": l_low=1 if i in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": l_upp=1 if i in "!@#$%^&*()-+": l_special=1 if not l_num: count +=1 if not l_low: count += 1 if not l_upp : count += 1 if not l_special: count += 1 if l_diff<0: l_diff=-1*l_diff if n>=6: if count: return count else: return 0 else: if l_diff>=count: return l_diff else: return count if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)