#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  string b;
  cin >> b;
  int cnt = 0;
  int mx = -1;
  bool fail = 0;
  for (int i = 0; i < n;) {
    mx = max(mx, a[i]);
    ++cnt;
    int j = i + 1;
    for (; j < n and mx > cnt; ++j) {
      mx = max(mx, a[j]);
      ++cnt;
    }
    --j;
    for (int k = i; k < j; ++k) {
      if (b[k] == '0') {
        fail = 1;
        break;
      }
    }
    i = j + 1;
  }
  cout << (fail ? "NO" : "YES") << endl;
  return 0;
}
