#include <bits/stdc++.h>
#include <algorithm>
#define MIN(a,b)  (a<b?a:b)
#define MAX(a,b)  (a>b?a:b)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
using namespace std;
string  numbers ( "0123456789");
string  lower_case ( "abcdefghijklmnopqrstuvwxyz");
string  upper_case ( "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
string  special_characters ( "!@#$%^&*()-+");

typedef unsigned long long ull;
typedef long double ld;
//TODO : pair , string , priority_queue, set, map, sort, algorithm 

int main(int argc, char*argv[])
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n ;
	cin >> n;
	string  password;
	cin >> password;
	int len = password.size();
	int a=1, b=1, c=1, d=1;
	for(int i=0;i<len;i++)
	{
		if(a && (password.at(i) >='0' && password.at(i) <='9'))
			a--;
		if(b && (password.at(i) >='a' && password.at(i) <='z'))
			b--;
		if(c && (password.at(i) >='A' && password.at(i) <='Z'))
			c--;
		if(d && (special_characters.find(password.at(i))!=string::npos))
			d--;
	}	
	int ret = 	a+b+c+d;
	//cout << ret<<endl;
	if(len <= 6-ret)
		ret += (6-ret-len);
	cout << ret<<endl;
}