#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  string str;
  cin >> str;
  bool flag = 0;
  int start = 0;
  set<int> s;
  for (int i = 0; i < str.length(); i++) {
    if (!flag && str[i] == '0' && a[i] != i + 1) {
      cout << "NO" << endl;
      return 0;
    }
    if (flag && str[i] == '0') {
      s.insert(a[i]);
      for (int j = start; j <= i + 1; j++) {
        if (s.find(j) == s.end()) {
          cout << "NO" << endl;
          return 0;
        }
      }
      s.clear();
      flag = 0;
    }
    if (str[i] == '1') {
      s.insert(a[i]);
      if (!flag) {
        start = i + 1;
      }
      flag = 1;
    }
  }
  cout << "YES" << endl;
  return 0;
}
