#!/bin/python import sys def number_check(password): numbers = "0123456789" num_check = 1 for i in numbers: if i in password: num_check = 0 return num_check def lower_check(password): lower_case = "abcdefghijklmnopqrstuvwxyz" low_check = 1 for i in lower_case: if i in password: low_check = 0 return low_check def upper_check(password): upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" up_check = 1 for i in upper_case: if i in password: up_check = 0 return up_check def char_check(password): special_characters = "!@#$%^&*()-+" ch_check = 1 for i in special_characters: if i in password: ch_check = 0 return ch_check def minimumNumber(n, password): len_check =0 if n < 6: len_check = 6-n num_check = number_check(password) low_check = lower_check(password) up_check = upper_check(password) ch_check = char_check(password) if len_check > num_check+low_check+up_check+ch_check: return len_check else: return num_check+low_check+up_check+ch_check if __name__ == "__main__": n = int(raw_input().strip()) password = raw_input().strip() answer = minimumNumber(n, password) print answer