#!/bin/python3 import sys import re def minimumNumber(n, password): count = 4 if re.search(r'\d', password, flags=0): count -= 1 if re.search(r'[A-Z]', password, flags=0): count -= 1 if re.search(r'[a-z]', password, flags=0): count -= 1 if re.search(r'[!@#$%^&*()\-+]', password, flags=0): count -= 1 char_needed = 6 - n if count > char_needed: return count else: return char_needed if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)