{"raw_statement":[{"iden":"problem statement","content":"There are $N$ people, each of whom is either a child or an adult. The $i$\\-th person has a weight of $W_i$.  \nWhether each person is a child or an adult is specified by a string $S$ of length $N$ consisting of `0` and `1`.  \nIf the $i$\\-th character of $S$ is `0`, then the $i$\\-th person is a child; if it is `1`, then the $i$\\-th person is an adult.\nWhen Takahashi the robot is given a real number $X$, Takahashi judges a person with a weight less than $X$ to be a child and a person with a weight more than or equal to $X$ to be an adult.  \nFor a real value $X$, let $f(X)$ be the number of people whom Takahashi correctly judges whether they are children or adults.\nFind the maximum value of $f(X)$ for all real values of $X$."},{"iden":"constraints","content":"*   $1\\leq N\\leq 2\\times 10^5$\n*   $S$ is a string of length $N$ consisting of `0` and `1`.\n*   $1\\leq W_i\\leq 10^9$\n*   $N$ and $W_i$ are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$S$\n$W_1$ $W_2$ $\\ldots$ $W_N$"},{"iden":"sample input 1","content":"5\n10101\n60 45 30 40 80"},{"iden":"sample output 1","content":"4\n\nWhen Takahashi is given $X=50$, it judges the $2$\\-nd, $3$\\-rd, and $4$\\-th people to be children and the $1$\\-st and $5$\\-th to be adults.  \nIn reality, the $2$\\-nd and $4$\\-th are children, and the $1$\\-st, $3$\\-rd, and $5$\\-th are adults, so the $1$\\-st, $2$\\-nd, $4$\\-th, and $5$\\-th people are correctly judged. Thus, $f(50)=4$.\nThis is the maximum since there is no $X$ that judges correctly for all $5$ people. Thus, $4$ should be printed."},{"iden":"sample input 2","content":"3\n000\n1 2 3"},{"iden":"sample output 2","content":"3\n\nFor example, $X=10$ achieves the maximum value $f(10)=3$.  \nNote that the people may be all children or all adults."},{"iden":"sample input 3","content":"5\n10101\n60 50 50 50 60"},{"iden":"sample output 3","content":"4\n\nFor example, $X=55$ achieves the maximum value $f(55)=4$.  \nNote that there may be multiple people with the same weight."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}