import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String s = in.next(); int checks = 0; if (s.matches(".*[0-9]+.*")) checks++; if (s.matches(".*[a-z]+.*")) checks++; if (s.matches(".*[A-Z]+.*")) checks++; if (s.matches(".*[\\!\\@\\#\\$\\%\\^\\&\\*\\(\\)\\-\\+]+.*")) checks++; System.out.println(Math.max(6 - n, 4 - checks)); in.close(); } }