#include using namespace std; #define FAST_CC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define fi first #define se second #define pb push_back #define RESET(s, x) memset(s, x, sizeof(s)) typedef long long ll; typedef vector vi; typedef pair ii; typedef vector vii; typedef vector viii; const double PI = acos(-1.0); const double EPS = 1e-9; const int MOD = 1e9 + 7; const int INF = 1e9; const long long INFLL = 4e18; const int dr[] = {-1, 0, 1, 0, -1, 1, 1, -1}; const int dc[] = {0, 1, 0, -1, 1, 1, -1, -1}; bool isspec(char c) { string special = "!@#$%^&*()-+"; for (int i = 0; i < special.length(); i++) { if (c == special[i]) return true; } return false; } int main() { FAST_CC int n; cin >> n; string s; cin >> s; int lc, uc, dig, spec; lc = uc = dig = spec = 0; for (int i = 0; i < n; i++) { if (islower(s[i])) lc++; else if (isupper(s[i])) uc++; else if (isdigit(s[i])) dig++; else if (isspec(s[i])) spec++; } int need = 0; if (lc < 1) need++; if (uc < 1) need++; if (dig < 1) need++; if (spec < 1) need++; //printf("%d %d %d %d %d\n", lc, uc, dig, spec, need); if (n + need < 6) need += (6 - n - need); //printf("%d %d %d %d %d\n", lc, uc, dig, spec, need); printf("%d\n", need); return 0; }