#include #include using namespace std; int func(int n, string p) { int hasDigit=1; int hasSp=1; int hasLC=1; int hasUC=1; for(int i=0;i='0'&&p[i]<='9') hasDigit=0; else if(p[i]>='a'&&p[i]<='z') hasLC=0; else if(p[i]>='A'&&p[i]<='Z') hasUC=0; else if(p[i]=='!'||p[i]=='@'||p[i]=='#'||p[i]=='$'||p[i]=='%'||p[i]=='^'||p[i]=='&'||p[i]=='*'||p[i]=='('||p[i]==')'||p[i]=='-'||p[i]=='+') hasSp=0; } if(n<=3) return 6-n; if(n>=6) return hasDigit+hasSp+hasLC+hasUC; if(n==4){ if((hasDigit+hasSp+hasLC+hasUC)>=2) return hasDigit+hasSp+hasLC+hasUC; else return 2; } if(n==5){ if((hasDigit+hasSp+hasLC+hasUC)>=1) return hasDigit+hasSp+hasLC+hasUC; else return 1; } return 0; } int main() { int n; cin >> n; string password; cin >> password; int answer = func(n, password); cout << answer << endl; return 0; }