/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author Nehal Kalnad */ import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static boolean cont(String s , char c) { for(int i = 0 ; i < s.length() ; i++) { if(s.charAt(i) == c) return true; } return false; } static int minimumNumber(int n, String p) { int uC = 0 , lC = 0, num = 0, spec = 0; String numbers = "0123456789"; String low = "abcdefghijklmnopqrstuvwxyz"; String up = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; String sp = "!@#$%^&*()-+"; for(int i = 0 ; i < n ; i++) { char c = p.charAt(i); if(cont(numbers , c)) num = 1; else if(cont(low , c)) lC = 1; else if(cont(up , c)) uC = 1; else if(cont(sp , c)) spec = 1; } int need = 4 - num - lC - uC - spec; if(6-n > need) return 6-n; return need; } 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(); } }