#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n;
  cin >> n;
  string s;
  vector<long long int> arr(n + 1);
  for (long long int i = 1; i <= n; i++) cin >> arr[i];
  cin >> s;
  vector<long long int> pre(n, 0);
  if (s.back() == '1') pre[n - 1] = 1;
  for (int i = n - 2; i >= 0; i--) {
    if (s[i] == '1')
      pre[i] = 1 + pre[i + 1];
    else
      pre[i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    if (i > arr[i]) {
      if (arr[i] + pre[arr[i] - 1] < i) {
        cout << "NO\n";
        return;
      }
    } else if (i < arr[i]) {
      if (i + pre[i - 1] < arr[i]) {
        cout << "NO\n";
        return;
      }
    }
  }
  cout << "YES\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  while (t--) {
    solve();
  }
}
