#!/bin/python3 import sys def minimumNumber(n, password): c=n d=0 e=0 f=0 g=0 z='!@#$%^&*()-+' for i in password: if i.islower(): d=1 if i.isupper(): e=1 if i.isnumeric(): f=1 if i in z: g=1 x=4-d-e-f-g c=c+x if c<6: return 6-c+x else: return x # 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)