Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

The problem statement has recently been changed. View the changes.

×
C. Swap Adjacent Elements

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou have an array *a* consisting of *n* integers. Each integer from 1 to *n* appears exactly once in this array.

For some indices *i* (1 ≤ *i* ≤ *n* - 1) it is possible to swap *i*-th element with (*i* + 1)-th, for other indices it is not possible. You may perform any number of swapping operations any order. There is no limit on the number of times you swap *i*-th element with (*i* + 1)-th (if the position is not forbidden).

Can you make this array sorted in ascending order performing some sequence of swapping operations?

Input

The first line contains one integer *n* (2 ≤ *n* ≤ 200000) — the number of elements in the array.

The second line contains *n* integers *a*_{1}, *a*_{2}, ..., *a*_{n} (1 ≤ *a*_{i} ≤ 200000) — the elements of the array. Each integer from 1 to *n* appears exactly once.

The third line contains a string of *n* - 1 characters, each character is either 0 or 1. If *i*-th character is 1, then you can swap *i*-th element with (*i* + 1)-th any number of times, otherwise it is forbidden to swap *i*-th element with (*i* + 1)-th.

Output

If it is possible to sort the array in ascending order using any sequence of swaps you are allowed to make, print YES. Otherwise, print NO.

Examples

Input

6

1 2 5 3 4 6

01110

Output

YES

Input

6

1 2 5 3 4 6

01010

Output

NO

Note

In the first example you may swap *a*_{3} and *a*_{4}, and then swap *a*_{4} and *a*_{5}.

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Aug/02/2021 07:00:36 (i2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|