#!/bin/python3 import sys def minimumNumber(n, password): numbers = "0123456789" lower_case = "abcdefghijklmnopqrstuvwxyz" upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" special_characters = "!@#$%^&*()-+" c1, c2, c3, c4 = 0, 0, 0, 0 for c in password: c1 += 1 if c in numbers else 0 c2 += 1 if c in lower_case else 0 c3 += 1 if c in upper_case else 0 c4 += 1 if c in special_characters else 0 count = 0 count += 1 if c1 > 0 else 0 count += 1 if c2 > 0 else 0 count += 1 if c3 > 0 else 0 count += 1 if c4 > 0 else 0 a1 = max(0, 4 - count) diff = max(0, 6 - len(password)) return max(a1, diff) if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)