#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m, j, r = 0, k, l = 0, i, p = 0, q = 0, flag = 0, t;
  cin >> n;
  vector<long long> a;
  a.push_back(0);
  for (long long i = 0; i < n; i++) {
    cin >> m;
    a.push_back(m);
  }
  string s;
  cin >> s;
  long long t1 = 1;
  for (long long i = 1; i < n; i++) {
    if (s[i - 1] == '0') {
      for (long long j = t1; j < i + 1; j++) {
        if (a[j] > i) {
          cout << "NO";
          return 0;
        }
      }
      t1 = i;
    }
    if (s[i - 1] == '1') {
      if (a[i] > a[i + 1]) {
        long long temp = a[i];
        a[i] = a[i + 1];
        a[i + 1] = temp;
      }
    }
  }
  cout << "YES";
  return 0;
}
