#!/bin/python import sys def minimumNumber(n, password): # Return the minimum number of characters to make the password strong lower=1 upper=1 digits=1 special=1 for c in password: if c in "0123456789": digits=0 elif c in "abcdefghijklmnopqrstuvwxyz": lower=0 elif c in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": upper=0 elif c in "!@#$%^&*()-+": special=0 min_len = 0 if len(password)<6: min_len+=6-len(password) return max(min_len,lower+upper+digits+special) if __name__ == "__main__": n = int(raw_input().strip()) password = raw_input().strip() answer = minimumNumber(n, password) print answer