#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vii;
#define floop(i,a,b) for(ll i=a;i<=b;i++)
int check(string a,string b)
{
    int l=a.length();
    int l1=b.length();
    int f=0;
    int i,j;
   floop(i,0,l-1)
   {
       floop(j,0,l1-1)
       {
           if(a[i]==b[j])
           {
               f=1;break;
            }
       }
   }
    return f;
}
int main()
{
string numbers = "0123456789";
string lower_case = "abcdefghijklmnopqrstuvwxyz";
string upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string special_characters = "!@#$%^&*()-+";
    string s;
    int n;
    int count=0;
    int i;
    cin>>n>>s;
    int less=0;
    int l=s.length();
    if(l<6)
        less=6-l;
  if(check(numbers,s)==0)
  {
       count++;
  }
  if(check(lower_case,s)==0)
  {
       count++;
  }
  if(check(upper_case,s)==0)
  {
       count++;
  }
  if(check(special_characters,s)==0)
  {
       count++;
  }
  if(less<count)
      cout<<count;
  else
       cout<<less;
    return 0;
}