#!/bin/python3 import sys def minimumNumber(n, password): numbers = "0123456789" lower_case = "abcdefghijklmnopqrstuvwxyz" upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" special_characters = "!@#$%^&*()-+" p = list(password) if n==0: return 6 d = 0 u = 0 l = 0 s = 0 for c in p: if c in list(upper_case): u = 1 elif c in list(lower_case): l = 1 elif c.isdigit(): d = 1 elif c in list(special_characters): s = 1 count = 0 if d==0: count = count+1 if u==0: count = count+1 if l==0: count = count+1 if s==0: count = count+1 if n+count < 6: return 6-n return count if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)