#include using namespace std; string numbers = "0123456789"; string lower_case = "abcdefghijklmnopqrstuvwxyz"; string upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string special_characters = "!@#$%^&*()-+"; int minimumNumber(int n, string password) { int count = 4; bool has_num = false, has_lc = false, has_uc = false, has_sc = false; for (int i = 0; i < n; ++i) { char c = password[i]; if (c >= '0' and c <= '9' and !has_num) { count--; has_num = true; } else if (c >= 'a' and c <= 'z' and !has_lc) { count--; has_lc = true; } else if (c >= 'A' and c <= 'Z' and !has_sc) { count--; has_sc = true; } else if (special_characters.find(c) != std::string::npos and !has_uc) { count--; has_uc = true; } } if (n < 6) { count = std::max(count, 6 - n); } return count; } int main() { int n; cin >> n; string password; cin >> password; int answer = minimumNumber(n, password); cout << answer << endl; return 0; }