#include <bits/stdc++.h>
using namespace std;
int a[200001], n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int targ = 0;
  char b;
  bool c = 0;
  for (int i = 0; i < n - 1; i++) {
    cin >> b;
    if (targ < a[i]) {
      targ = a[i];
    }
    if (b == '0') {
      if (targ > (i + 1)) {
        c = 1;
        cout << "NO";
        break;
      }
    }
  }
  if (!c) {
    cout << "YES";
  }
}
