#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 2;
int arr[MAX];
bool can[MAX], is[MAX];
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> arr[i];
  for (int i = 0; i < n - 1; ++i) {
    char ch;
    cin >> ch;
    can[i] = (ch == '1');
  }
  bool ans = true;
  is[arr[0]] = true;
  for (int l = 0, r = 0; l < n;) {
    while (can[r]) {
      ++r;
      is[arr[r]] = true;
    }
    for (int i = l; i <= r; ++i) {
      if (!is[i + 1]) ans = false;
      is[i + 1] = false;
    }
    is[arr[r + 1]] = true;
    l = r = r + 1;
  }
  if (ans)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
