Farmer John's N cows (2≤N≤3⋅105), conveniently numbered 1…N as usual, have ordered themselves according to a permutation p_1,p_2,…,p_N of 1…N. You are also given a string of length N−1 consisting of the letters U and D. Please find the maximum K≤N−1 such that there exists a subsequence a_0,a_1,…,a_K of p such that for all 1≤j≤K, a_j−1<a_j if the jth letter in the string is U, and a_j−1>a_j if the jth letter in the string is D.
The first line contains N.
The second line contains p_1,p_2,…,p_N.
The last line contains the string.
Write out maximum possible value of K.