#!/bin/python3 import sys def minimumNumber(n, p): # Return the minimum number of characters to make the password strong num = "0123456789" l = "abcdefghijklmnopqrstuvwxyz" u = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" s = "!@#$%^&*()-+" nc,lc,uc,sc=0,0,0,0 for v in p: if num.find(v)>=0:nc=1 elif l.find(v)>=0:lc=1 elif u.find(v)>=0:uc=1 elif s.find(v)>=0:sc=1 need=4-(nc+lc+uc+sc) return max(need,6-int(n)) if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)