#!/bin/python import sys numbers = set("0123456789") lower_case = set("abcdefghijklmnopqrstuvwxyz") upper_case = set("ABCDEFGHIJKLMNOPQRSTUVWXYZ") special_characters = set("!@#$%^&*()-+") def minimumNumber(password): # Return the minimum number of characters to make the password strong need = 0 if not any(map(lambda x: x in numbers, password)): need += 1 if not any(map(lambda x: x in lower_case, password)): need += 1 if not any(map(lambda x: x in upper_case, password)): need += 1 if not any(map(lambda x: x in special_characters, password)): need += 1 if len(password) + need < 6: return 6 - len(password) return need if __name__ == "__main__": n = int(raw_input().strip()) password = raw_input().strip() answer = minimumNumber( password) print answer