#include <bits/stdc++.h>
using namespace std;
long long inf = 99999999999999999;
long long M = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  long long a[n], b[n];
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  string s;
  cin >> s;
  long long c = 1;
  for (long long i = 0; i < s.size(); i++) {
    if (s[i] == '0') c = 0;
  }
  if (c == 1) {
    cout << "YES\n";
    return 0;
  }
  long long f = 1;
  for (long long i = 1; i <= n; i++) {
    if (a[i] > i) {
      long long dif = a[i] - i - 1;
      long long tm = dif;
      long long j = i;
      ;
      while (j <= i + dif) {
        if (s[j - 1] == '0') {
          f = 0;
          break;
        }
        if (a[j] != j) {
          long long val = a[j] - j - 1;
          if (val > tm) break;
        }
        tm--;
        j++;
      }
      if (f == 0) {
        break;
      }
      i = j - 1;
    }
  }
  for (long long i = n; i > 0; i--) {
    if (a[i] < i) {
      long long dif = i - a[i] - 1;
      long long tm = dif;
      long long j = i - 1;
      while (j >= i - dif - 1) {
        if (s[j - 1] == '0') {
          f = 0;
          break;
        }
        if (a[j] != j) {
          long long val = a[j] - j - 1;
          if (val > tm) break;
        }
        tm--;
        j--;
      }
      if (f == 0) {
        break;
      }
      i = j + 1;
    }
  }
  if (f)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
