#!/bin/python3 import sys def minimumNumber(n, a): # Return the minimum number of characters to make the password strong e=1 f=1 g=1 h=1 b="!@#$%^&*()-+" c="0123456789" if n>=6: for i in a: if ord(i)<=90 and ord(i)>=65: e=0 elif ord(i)<=122 and ord(i)>=97: f=0 elif i in b: g=0 elif i in c: h=0 if e==1 and f==1 and g==1 and h==1: break return e+f+g+h elif n>2: for i in a: if ord(i)<=90 and ord(i)>=65: e=0 elif ord(i)<=122 and ord(i)>=97: f=0 elif i in b: g=0 elif i in c: h=0 if e==1 and f==1 and g==1 and h==1: break return max(6-n,e+f+g+h) else: return 6-n if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)