numbers = '0123456789' lower_case = 'abcdefghijklmnopqrstuvwxyz' upper_case = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' special_characters = '!@#$%^&*()-+' def solve(n, pw): a, b, c, d = 1, 1, 1, 1 q = max(0, 6 - n) for ch in pw: if ch in numbers: a = 0 if ch in lower_case: b = 0 if ch in upper_case: c = 0 if ch in special_characters: d = 0 return max(q, a + b + c + d) n = int(raw_input()) pw = raw_input().strip() print(solve(n, pw))