#include <cstring>
#include <iostream>
#include <vector>
using namespace std;
const int maxn = 2e5 + 7;
int nums[maxn];
bool mark[maxn];
int sums[maxn << 2];
int n;
int lowbit(int i) {
return i & (-i);
}
void update(int o) {
while (o < n) {
sums[o] += 1;
o += lowbit(o);
}
}
int query(int o) {
int ans = 0;
while (o > 0) {
ans += sums[o];
o -= lowbit(o);
}
return ans;
}
bool fuck(int i) {
if (nums[i] == i) return 1;
int min1 = min(nums[i], i);
int max1 = max(nums[i], i);
int lefts = query(min1 - 1);
int rights = query(max1 - 1);
// cout << min1 << ":" << max1 << " " << lefts << ":" << rights << endl;
if (rights - lefts < (max1 - min1)) {
return 0;
}
return 1;
}
int main() {
scanf("%d", &n);
memset(mark, 0, sizeof mark);
for (int i = 1; i <= n; ++i) {
scanf("%d", &nums[i]);
}
for (int i = 1; i < n; ++i) {
char c;
do {
scanf("%c", &c);
} while (c != '0' && c != '1');
if (c == '1') {
update(i);
}
}
for (int i = 1; i < n; ++i) {
if (fuck(i))
continue;
else {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
}