#include #include #include #include #include using namespace std; string numbers = "0123456789"; string lower_case = "abcdefghijklmnopqrstuvwxyz"; string upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string special_characters = "!@#$%^&*()-+"; bool hasElem(string s, string ref) { for (auto it = s.begin(); it != s.end(); ++it) if (ref.find(*it) != string::npos) return true; return false; } int forGoodPwd(int n, string pwd) { int req = 0; if (!hasElem(pwd, numbers)) req += 1; if (!hasElem(pwd, lower_case)) req += 1; if (!hasElem(pwd, upper_case)) req += 1; if (!hasElem(pwd, special_characters)) req += 1; return (max(n + req, 6) - n); } int main() { int len; string pwd; cin >> len >> pwd; int n = forGoodPwd(len, pwd); cout << n << endl; return 0; }