#!/bin/python import sys def minimumNumber(n, password): # Return the minimum number of characters to make the password strong l = 6 digit = 1 lower = 1 upper = 1 special = 1 if n<6: c = 6-n else: c = 0 for i in password: if i in '!@#$%^&*()-+': special = 0 if 48<=ord(i) and ord(i)<=57: digit = 0 if 65<=ord(i) and ord(i)<=90: upper = 0 if 97<=ord(i) and ord(i)<=122: lower = 0 more = special + upper + lower + digit if c == 0: return more elif c>=more: return c else: return more if __name__ == "__main__": n = int(raw_input().strip()) password = raw_input().strip() answer = minimumNumber(n, password) print answer