#!/bin/python import sys ''' Its length is at least . It contains at least one digit. It contains at least one lowercase English character. It contains at least one uppercase English character. It contains at least one special character. The special characters are: !@#$%^&*()-+ ''' def minimumNumber(n, s): f1=0;f2=0;f3=0;f4=0 l1=['0','1','2','3','4','5','6','7','8','9'] l2=['!','@','#','$','%','^','&','*','(',')','-','+'] for i in l1: if i in s: f1=1 break for i in l2: if i in s: f4=1 break for i in s: if ord(i)>=97 and ord(i)<=122: f2=1 break for i in s: if ord(i)>=65 and ord(i)<=90: f3=1 break if f1==1 and f2==1 and f3==1 and f4==1 and len(s)>=6: return 0 elif f1==1 and f2==1 and f3==1 and f4==1 and len(s)<6: return 6-len(s) else: l=[f1,f2,f3,f4] #if len(s)<6: x=l.count(0) if x+len(s)<6: return 6-len(s) else: return x # Return the minimum number of characters to make the password strong if __name__ == "__main__": n = int(raw_input().strip()) password = raw_input().strip() answer = minimumNumber(n, password) print answer