#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long int n;
  cin >> n;
  unsigned long long int arr[n + 1];
  unsigned long long int ind[n + 1];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    ind[arr[i]] = i;
  }
  string s;
  cin >> s;
  int c = 1;
  int p;
  for (int i = 0; i < n; i++) {
    p = 0;
    if (s[i] == '0') {
      for (int k = c; k <= i + 1; k++) {
        if (ind[k] > i) {
          p = 1;
          break;
        }
      }
      if (p == 1) break;
      c = i + 1;
    }
  }
  if (p == 0)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
