#!/bin/python3 import sys def minimumNumber(n, password): special = "!@#$%^&*()-+" x=0 if n<6: if not any(c.isdigit() for c in password): x=x+1 if not any(c.islower() for c in password): x=x+1 if not any(c.isupper() for c in password): x=x+1 if not any(c in special for c in password): x=x+1 if x>6-n: return x else: return (6-n) if n>=6: if not any(c.isdigit() for c in password): x=x+1 if not any(c.islower() for c in password): x=x+1 if not any(c.isupper() for c in password): x=x+1 if not any(c in special for c in password): x=x+1 return x if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)