#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;


int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
    string s,v="!@#$%^&*()-+";
    cin >> s;
    cin >> s;
    int l=0,n=0,u=0,sp=0,len = s.length();
    for(int i=0;i<s.length();i++)
    {
        if(isupper(s[i]))
        {
            u++;
        }
        else if(islower(s[i]))
        {
            l++;
        }
        else if(isdigit(s[i]))
        {
            n++;
        }
        else
        {
            for(int j=0;j<v.length();j++)
            {
                if(s[i] == v[j])
                {
                    sp++;
                    break;
                }
            }
        }
        
            
    }
    int g=0,po=0;
    if(s.length() < 6)
    {
        g = 6-s.length();
    }
  // cout << u<<" "<<l <<" "<< n<<" "<<sp<<'\n';
    if(sp==0)
    {
        if(g<=0)
        {
            //po++;
            g++;
        }
        po++;
    }
    if(n==0)
    {
        
        if(g-po<=0)
        {
           
            g++;
        }
        po++;
    }
     if(u==0)
    {
        if(g-po<=0)
        {
            //po++;
            g++;
        } 
         po++;
    }
   // cout << g-po <<'\n';
        if(l==0)
    {
        if(g-po <=0)
        {
           // po++;
            g++;
        }
    }
    cout << g;
    
    return 0;
}