#include <bits/stdc++.h>
using namespace std;
const int maxn = 200007;
const int inf = 0x3f3f3f3f;
int a[maxn], b[maxn];
char s[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, f;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  cin >> s + 1;
  b[0] = 0;
  for (int i = 1; i < n; i++) {
    if (s[i] == '1')
      b[i] += b[i - 1] + 1;
    else
      b[i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] > i) {
      if ((b[a[i] - 1] - b[i - 1]) < (a[i] - i)) {
        puts("NO");
        return 0;
      }
    } else {
      if ((b[i - 1] - b[a[i] - 1]) < (i - a[i])) {
        puts("NO");
        return 0;
      }
    }
  }
  puts("YES");
  return 0;
}
