using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Solution {

    static int AddChar(string password, string crit) => 
            password.Any(c => crit.Contains(c))
            ? 0
            : 1;
    
    static int minimumNumber(int n, string password, string[] criteria) {    
        var addChars = criteria.Select(crit => AddChar(password, crit)).Sum();
        var length = password.Length + addChars;
        return length < 6
            ? addChars + (6 - length)
            : addChars;
    }
    
    

    static void Main(String[] args) {
        int n = Convert.ToInt32(Console.ReadLine());
        string password = Console.ReadLine();
        var numbers = "0123456789";
var  lower = "abcdefghijklmnopqrstuvwxyz";
var  upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var  special = "!@#$%^&*()-+";
        int answer = minimumNumber(n, password, new string[] {numbers, lower, upper, special});
        Console.WriteLine(answer);
    }
}