#!/bin/python3 import sys def minimumNumber(n, password): # Return the minimum number of characters to make the password strong no, lo, up, sp = True, True, True, True count = 4 sp_char = "!@#$%^&*()-+" for l in password: c = ord(l) if no and 47 < c < 58: no = False count -= 1 elif lo and 96 < c < 123: lo = False count -= 1 elif up and 64 < c < 91: up = False count -= 1 elif sp and l in sp_char: sp = False count -= 1 if count == 0: break return max(6-n,count) if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)