#!/bin/python import sys numbers = "0123456789" lower_case = "abcdefghijklmnopqrstuvwxyz" upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" special_characters = "!@#$%^&*()-+" def minimumNumber(n, password): # Return the minimum number of characters to make the password strong t1 = 0 t2 = 0 t3 = 0 t4 = 0 for c in password: if c in numbers: t1 = 1 if c in lower_case: t2 = 1 if c in upper_case: t3 = 1 if c in special_characters: t4 = 1 rs = 4 - (t1 + t2 + t3 + t4) if n < 6: return max(rs, 6 - n) else: return rs if __name__ == "__main__": n = int(raw_input().strip()) password = raw_input().strip() answer = minimumNumber(n, password) print answer