#include <bits/stdc++.h>
using namespace std;
long long int MOD = 1000000007;
long long int powe(long long int a, long long int b) {
  long long int x = 1, y = a;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x * y);
      x %= MOD;
    }
    y = (y * y);
    y %= MOD;
    b /= 2;
  }
  return x;
}
long long int InverseEuler(long long int n) { return powe(n, MOD - 2); }
int a[500010];
int b[500010];
int h[500010];
int l = 0;
int r = 0;
vector<int> comp[200010];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  string s;
  cin >> s;
  vector<pair<int, int> > v;
  for (int i = 0; i < n - 1; i++) {
    b[i] = s[i] - '0';
  }
  int c = 0;
  for (int i = 0; i < n - 1;) {
    if (b[i] == 0) {
      i++;
    } else {
      int st = i;
      int en = i + 1;
      while (en < n - 1 && b[en] == 1) {
        en++;
      }
      v.push_back(make_pair(st, en));
      c++;
      i = en;
    }
  }
  for (int i = 0; i < v.size(); i++) {
    sort(a + v[i].first, a + v[i].second + 1);
  }
  bool f = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] != i + 1) {
      f = 1;
    }
  }
  if (f)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
  cout << endl;
  return 0;
}
