#!/bin/python3 import sys def minimumNumber(n, password): # Return the minimum number of characters to make the password strong a= list("0123456789") b= list("abcdefghijklmnopqrstuvwxyz") c= list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") d=list("!@#$%^&*()-+") c1=c2=c3=c4=0 for i in range(n): if(password[i] in a): c1=1 elif(password[i] in b): c2=1 elif(password[i] in c): c3=1 else: c4=1 return max(4-c1-c2-c3-c4,6-n) if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)