#!/bin/python import sys,re def minimumNumber(n, password): if n!=0: sp=0 lc=0 up=0 d=0 for i in range(n): if password[i].isdigit(): d=1 elif password[i].isupper(): up=1 elif password[i].islower(): lc=1 else: sp=1 count=0 if sp==0: count+=1 if lc==0: count+=1 if up==0: count+=1 if d==0: count+=1 if n+count<6: count+=(6-n-count) return count if __name__ == "__main__": n = int(raw_input().strip()) password = raw_input().strip() answer = minimumNumber(n, password) print answer