#!/bin/python3 import sys def minimumNumber(n, password): # Return the minimum number of characters to make the password strong l=n digit=0 lower=0 upper=0 special=0 for i in password: if i.isdigit(): digit+=1 elif i.islower(): lower+=1 elif i.isupper(): upper+=1 else: special+=1 if not digit: l+=1 if not upper: l+=1 if not lower: l+=1 if not special: l+=1 if l<6: return l-n+6-l else: return l-n if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)