#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 5;
int a[maxn], b[maxn];
map<int, int> ma;
int find(int x) { return x == b[x] ? x : b[x] = find(b[x]); }
void link(int x, int y) {
  x = find(x), y = find(y);
  if (x != y) b[y] = x;
}
int main() {
  int n;
  while (~scanf("%d", &n)) {
    ma.clear();
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      ma[a[i]] = i;
      b[i] = i;
    }
    getchar();
    for (int i = 1; i < n; i++) {
      int t = getchar() - '0';
      if (t) link(i, i + 1);
    }
    int f = 0;
    for (int i = 1; i <= n; i++) {
      if (a[i] == i) continue;
      if (find(i) != find(ma[i])) {
        f = 1;
        break;
      }
    }
    if (f)
      puts("NO");
    else
      puts("YES");
  }
}
