#include <bits/stdc++.h>
using namespace std;
int arr[200001];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int a;
    cin >> a;
    if (a > i) {
      arr[i - 1] = max(arr[i - 1], a - i);
    } else if (a < i) {
      arr[a - 1] = max(arr[a - 1], i - a);
    }
  }
  string s;
  cin >> s;
  int necessary = 0;
  for (int i = 0; i < n - 1; ++i) {
    necessary = max(necessary, arr[i]);
    if (necessary > 0) {
      if (s[i] == '0') {
        cout << "NO";
        return 0;
      }
      --necessary;
    }
  }
  cout << "YES";
  return 0;
}
