#!/bin/python3 import sys def minimumNumber(n, password): # Return the minimum number of characters to make the password strong a = list(password) b = ["!","@","#","$","%","^","&","*","(",")","-","+"] if any(x.isupper() for x in a): upper = 0 else: upper = 1 if any(x.islower() for x in a): lower = 0 else: lower = 1 if any(x.isdigit() for x in a): number = 0 else: number =1 ctr = 1 for i in a: if i in b: ctr = 0 break if len(a)>=6: leng = 0 else: leng = max(6-upper-lower-number-ctr-len(a),0) return leng+upper+lower+number+ctr if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)