//package com.adobe.common; import java.util.*; public class Solution { static int minimumNumber(int n, String password) { /* numbers = "0123456789" lower_case = "abcdefghijklmnopqrstuvwxyz" upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" special_characters = "!@#$%^&*()-+" */ HashSet numbers = new HashSet(); for (int i = 0; i < 10; i++) { numbers.add((char) (i + 48)); } HashSet lower_case = new HashSet(); for (int i = 0; i < 26; i++) { lower_case.add((char) (i + 97)); } HashSet upper_case = new HashSet(); for (int i = 0; i < 26; i++) { upper_case.add((char) (i + 65)); } HashSet special = new HashSet(); special.add('!'); special.add('@'); special.add('#'); special.add('$'); special.add('%'); special.add('^'); special.add('&'); special.add('*'); special.add('('); special.add(')'); special.add('-'); special.add('+'); boolean isNumber = false; boolean isLowerCase = false; boolean isUpperCase = false; boolean isSpecialChar = false; int count = 0; for (char c : password.toCharArray()) { if (numbers.contains(c)) { isNumber = true; } else if (lower_case.contains(c)) { isLowerCase = true; } else if (upper_case.contains(c)) { isUpperCase = true; } else if (special.contains(c)) { isSpecialChar = true; } } if (!isNumber) { count++; } if (!isLowerCase) { count++; } if (!isUpperCase) { count++; } if (!isSpecialChar) { count++; } if (password.length() + count < 6) { count += (6 - (password.length() + count)); } return count; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String password = in.next(); int answer = minimumNumber(n, password); System.out.println(answer); in.close(); } }