#!/bin/python import sys numbers = "0123456789" lower_case = "abcdefghijklmnopqrstuvwxyz" upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" special_characters = "!@#$%^&*()-+" def has(string, chars): for i in range(len(chars)): if chars[i] in string: return True def minimumNumber(n, password): # Return the minimum number of characters to make the password strong min_num = 0 if n<6: min_num = 6-n min_addition = 0 if not has(password, numbers): min_addition +=1 if not has(password, lower_case): min_addition +=1 if not has(password, upper_case): min_addition +=1 if not has(password, special_characters): min_addition +=1 return max(min_addition, min_num) if __name__ == "__main__": n = int(raw_input().strip()) password = raw_input().strip() answer = minimumNumber(n, password) print answer