#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
const int MOD = 1e9 + 7;
const int INF = 2e9;
const long long LLINF = 4e18;
int n, t, tec, a[200000], b[200000], c[200000];
string s;
bool bb;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cin >> s;
  for (int i = 0; i < n; i++) {
    if (s[i - 1] == '1') {
      if (i == 0)
        b[i] = 1;
      else
        b[i] = b[i - 1] + 1;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '1') {
      if (i == n - 1)
        c[i] = 1;
      else
        c[i] = c[i + 1] + 1;
    }
  }
  for (int i = 0; i < n; i++) {
    if (a[i] < i + 1) {
      if (b[i] < i + 1 - a[i]) bb = 1;
    } else {
      if (c[i] < a[i] - (i + 1)) bb = 1;
    }
  }
  if (bb)
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
