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