#!/bin/python3 import sys numbers = "0123456789" lower_case = "abcdefghijklmnopqrstuvwxyz" upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" special_characters = "!@#$%^&*()-+" req_num = 6 def minimumNumber(n, password): req = 0 # Return the minimum number of characters to make the password strong without_lower = set(password) & set(lower_case) if not without_lower: req += 1 without_num = set(password) & set(numbers) if not without_num: req += 1 without_upper = set(password) & set(upper_case) if not without_upper: req += 1 without_spec = set(password) & set(special_characters) if not without_spec: req += 1 if n >= 6: return req return max(6 - n, req) if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)