#include using namespace std; #define D(x) cout << #x << " " << x << endl string numbers = "0123456789"; string lower = "abcdefghijklmnopqrstuvwxyz"; string upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string special = "!@#$%^&*()-+"; bool isSpecial(string x) { size_t found = special.find(x); return found != string::npos; } bool isNumber(string x) { size_t found = numbers.find(x + ""); return found != string::npos; } bool isLower(string x) { size_t found = lower.find(x + ""); return found != string::npos; } bool isUpper(string x) { size_t found = upper.find(x + ""); return found != string::npos; } int minimumNumber(int n, string pass) { vector conditions(4, false); int nConditions = 0; for(int i = 0; i < pass.size() && nConditions <= 4; ++i) { char currChar = pass[i]; if(isSpecial(string(1, currChar)) && !conditions[0]) { conditions[0] = true; nConditions++; } if(isLower(string(1, currChar)) && !conditions[1]) { conditions[1] = true; nConditions++; } if(isUpper(string(1, currChar)) && !conditions[2]) { conditions[2] = true; nConditions++; } if(isNumber(string(1, currChar)) && !conditions[3]) { conditions[3] = true; nConditions++; } } int addConditions = (4 - nConditions); return addConditions + max(0, 6 - ((int) pass.size() + addConditions)); } int main() { int n; cin >> n; string password; cin >> password; cout << minimumNumber(n, password) << endl; return 0; }