import sys input = sys.stdin.readline numbers = "0123456789" lower_case = "abcdefghijklmnopqrstuvwxyz" upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" special_characters = "!@#$%^&*()-+" length = int(input()) n = input().strip('\n') low = 1 up = 1 spec = 1 num = 1 for letter in n: if letter in numbers: num = 0 if letter in lower_case: low = 0 if letter in upper_case: up = 0 if letter in special_characters: spec = 0 toAdd = max(6 - len(n), int(num) + int(low) + int(up) + int(spec)) print(toAdd)