#pragma GCC optimize ("O3") #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #include #include #include using namespace __gnu_pbds; typedef tree,rb_tree_tag, tree_order_statistics_node_update> ordered_set; #define FOR(i,a,b) for (int i=(a), _b=(b); i <= _b; i++) #define FORD(i,a,b) for (int i=(a), _b=(b); i >= _b; i--) #define REP(i,a) for (int i=0, _a=(a); i<_a; ++i) #define REPD(i,a) for (int i=(a)-1; i>=0; --i) #define fi first #define se second #define PB push_back #define EB emplace_back #define MP make_pair #define prev dkmmmmawifj #define next oidkmmmmaqof #define y0 chuquachula #define y1 tacadada #define left uzumakinaruto #define right uchihasasuke #define sec(x) 1.0/cos((x)) #define asec(x) acos(1.0/(x)) template int getbit(T s, int i) { return (s >> i) & 1; } template T onbit(T s, int i) { return s | (T(1) << i); } template T offbit(T s, int i) { return s & (~(T(1) << i)); } template int cntbit(T s) { return __builtin_popcount(s);} template T gcd(T a, T b){ T r; while (b != 0) { r = a % b; a = b; b = r; } return a;} template T lcm(T a, T b) { return a / gcd(a, b) * b; } #define PI (2 * acos((ld)0)) #define DEBUG(X) { cerr << #X << " = " << (X) << endl; } #define outSET(X) { cerr << #X << " = "; for (auto _:X) cerr << _ << ' '; cerr << endl; } #define outVEC(X) { cerr << #X << " = "; for (auto _:X) cerr << _ << ' '; cerr << endl; } #define outMAP(X) { cerr << #X << " = "; for (auto _:X) cerr <<'('<<_.fi<<' '<<_.se<<')'<<' '; cerr << endl; } #define debugfunc(f,x) printf("%s(%g) = %g\n",#f,(x),(f(x))); #define debugfunc2(f,x,y) printf("%s(%g,%g) = %g\n",#f,(x),(y),(f((x),(y)))); #define sqr(x) ((x) * (x)) #define __builtin_popcount __builtin_popcountll #define SZ(x) ((int)(x).size()) #define minheap priority_queue, greater > #define maxheap priority_queue > typedef long long ll; typedef unsigned long long ull; typedef std::pair pii; typedef std::pair pll; const int MAXN=5e5+100; const int MOD=1e9+7; const double eps=1e-12; const ll INF=1e16; inline string toStr(ll x) { string tmp=""; do tmp=char(x%10 +'0')+tmp; while (x/=10); return tmp; } inline ll toInt(string s) { ll res=0; for (auto x:s) res=res*10+x-'0'; return res; } inline string toBinStr(ll x) { string res=""; do res=(x%2?"1":"0")+res; while (x>>=1LL); return res; } /*template ends here*/ int main() { //freopen(".inp","r",stdin); freopen(".out","w",stdout); int len; scanf("%d",&len); string s; cin>>s; string p="!@#$%^&*()-+"; set S; for (auto x:p) S.insert(x); bool digit=false,low=false,up=false,symb=false; for (auto x:s) if (x>='0' && x<='9') digit=true; else if (x>='a' && x<='z') low=true; else if (x>='A' && x<='Z') up=true; else if (S.count(x)) symb=true; int res=digit+low+up+symb; if (res==4) printf("%d",max(0,6-len)); else { if (len>=6) printf("%d",4-res); else { res=len+4-res; printf("%d",res>=6?res-len:6-len); } } }