#!/bin/python import sys def minimumNumber(n, password): lower, upper, special, digit = True, True, True,True for x in password: if x in '!@#$%^&*()-+': special = False elif x.islower(): lower = False elif x.isupper(): upper = False elif x.isdigit(): digit = False if n < 6: return max(lower + upper + special + digit, 6-n) return lower + upper + special + digit if __name__ == "__main__": n = int(raw_input().strip()) password = raw_input().strip() answer = minimumNumber(n, password) print answer