#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, arr[200005];
  string swaps;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  cin >> swaps;
  int m = 0, flag = 0;
  for (int i = 1; i < n; i++) {
    m = max(m, arr[i]);
    if (swaps[i - 1] == '0' && m > i) {
      flag = 1;
      break;
    }
  }
  (flag) ? cout << "NO\n" : cout << "YES\n";
  return 0;
}
