#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if (x < y) x = y; }

int main() {
	int n;
	while (~scanf("%d", &n)) {
		char buf[101];
		scanf("%s", buf);
		bool d = false, l = false, u = false, s = false;
		rep(i, n) {
			char c = buf[i];
			if (isdigit(c))
				d = true;
			else if (islower(c))
				l = true;
			else if (isupper(c))
				u = true;
			else
				s = true;
		}
		int t = max(0, 6 - n);
		int ans = max(t, !d + !l + !u + !s);
		printf("%d\n", ans);
	}
	return 0;
}