#!/bin/python3 import sys def minimumNumber(n, password): def need_special(): ch="!@#$%^&*()-+" for i in ch: if i in list(password): return 0 return 1 def need_lower(): ch=[chr(i) for i in range(ord("a"),ord("z")+1)] for i in ch: if i in list(password): return 0 return 1 def need_upper(): ch=[chr(i) for i in range(ord("A"),ord("Z")+1)] for i in ch: if i in list(password): return 0 return 1 def need_num(): ch=[chr(i) for i in range(ord("0"),ord("9")+1)] for i in ch: if i in list(password): return 0 return 1 higher= lambda x,y: x if x>y else y return higher(need_num()+need_lower()+need_upper()+need_special(),6-n) if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)