#include <bits/stdc++.h>
using std::swap;
using std::vector;
void partition2(vector<int> &a, int l, int r, int &m1, int &m2) {
  int x = a[l];
  m1 = l;
  m2 = l;
  for (int i = l + 1; i <= r; i++) {
    if (a[i] == x) {
      m2++;
      swap(a[i], a[m2]);
    } else if (a[i] < x) {
      m2++;
      swap(a[i], a[m2]);
      swap(a[m1], a[m2]);
      m1++;
    }
  }
}
void randomized_quick_sort(vector<int> &a, int l, int r) {
  if (l >= r) {
    return;
  }
  int k = l + rand() % (r - l + 1);
  swap(a[l], a[k]);
  int m1, m2;
  partition2(a, l, r, m1, m2);
  randomized_quick_sort(a, l, m1 - 1);
  randomized_quick_sort(a, m2 + 1, r);
}
int gcd(int a, int b) {
  int c;
  c = a % b;
  while (c) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}
int main() {
  int n, n2, q, m, k, p;
  int i, j, l;
  int x, y, xl, xr, xn;
  int res = 0, tmp, resw = 10, resb = 10;
  std::cin >> n;
  vector<int> a(n);
  std::string b;
  for (i = 0; i < n; i++) std::cin >> a[i];
  for (i = 0; i < n; i++) std::cin >> b;
  res = 1;
  for (i = 0, j = 0; (i < (n - 1)) && res; i++) {
    if (b[i] == '0') {
      while ((j <= i) && res) {
        if (a[j] > (i + 1)) {
          res = 0;
        } else
          j++;
      }
    }
  }
  if (res)
    std::cout << "YES";
  else
    std::cout << "NO";
  return 0;
}
