#!/bin/python3 import sys def minimumNumber(n, password): num = list ('0123456789') small = list ('abcdefghijklmnopqrstuvwxyz') large = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ') # print (small) sp = list ('!@#$%^&*()-+') a = b = c = d = 0 for i in range (0,n): if password[i] in num: a = 1 if password[i] in small: b = 1 if password[i] in large: c = 1 if password[i] in sp: d = 1 cnt = 4-(a+b+c+d) if cnt+n < 6: return 6-n else: return cnt n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)