#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    arr[i]--;
  }
  string str;
  cin >> str;
  int swap[n];
  swap[0] = 0;
  for (int i = 1; i < n; i++) {
    swap[i] = str.at(i - 1) - '0';
  }
  int pre[n];
  pre[0] = 0;
  for (int i = 1; i < n; i++) {
    pre[i] = pre[i - 1] + swap[i];
  }
  for (int i = 0; i < n; i++) {
    int mx = max(i, arr[i]);
    int mn = min(i, arr[i]);
    if (pre[mx] - pre[mn] != mx - mn) {
      cout << "NO"
           << "\n";
      return 0;
    }
  }
  cout << "YES"
       << "\n";
}
