#!/bin/python3 import sys import re def minimumNumber(n, password): req = 4 digit = False lower = False upper = False special = False for char in password: if char in "0123456789": digit = True if char in "abcdefghijklmnopqrstuvwxyz": lower = True if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": upper = True if char in "!@#$%^&*()-+": special = True if (digit == True): req -= 1 if (lower == True): req -= 1 if (upper == True): req -= 1 if (special == True): req -= 1 if (n >= 6): return req else: return max(req, 6-n) if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)