#!/bin/python3 import sys def minimumNumber(n, password): cl=['!','@','#','$','%','^','&','*','(',')','-','+'] l=0 d=0 l=0 u=0 c=0 cnt=0 sol=0 if(n<=2): return 6-n for i in range (len(password)): x=password[i] if(ord(x)-ord('0')<10 and d==0 and ord(x)-ord('0')>=0): d=1 if(ord(x)-ord('a')<26 and l==0 and ord(x)-ord('a')>=0): l=1 if(ord(x)-ord('A')<=26 and u==0 and ord(x)-ord('A')>=0): u=1 if x in cl and c==0: c=1 if l==0: sol=sol+1 if u==0: sol+=1 if c==0: sol+=1 if d==0: sol+=1 tem=len(password)+sol if(tem<6): return sol+6-tem return sol # Return the minimum number of characters to make the password strong if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)