#!/bin/python3 import sys def minimumNumber(n, password): numbers = "0123456789" lower_case = "abcdefghijklmnopqrstuvwxyz" upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" special_characters = "!@#$%^&*()-+" mlist = [0 for i in range(4)] for x in password: if x in numbers: mlist[0] = 1 if x in lower_case: mlist[1] = 1 if x in upper_case: mlist[2] = 1 if x in special_characters: mlist[3] = 1 return max(4-sum(mlist), 6-n) if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)