#!/bin/python3 import sys def minimumNumber(n, password): # Return the minimum number of characters to make the password strong small = 0 big = 0 digit = 0 special = 0 num = 0 for i in range(n): if ord(password[i]) >= 65 and ord(password[i]) <= 90: big += 1 elif ord(password[i]) >= 97 and ord(password[i]) <= 122: small += 1 elif ord(password[i]) >= 48 and ord(password[i]) <= 57: digit += 1 else: special += 1 if small == 0: num += 1 if big == 0: num += 1 if digit == 0: num += 1 if special == 0: num += 1 num = num if num >= 6-n else 6-n return num if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)