#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  string isSwap;
  cin >> isSwap;
  int cumOnes[n];
  cumOnes[0] = 0;
  for (int i = 1; i < n; i++)
    cumOnes[i] = cumOnes[i - 1] + (isSwap[i - 1] - '0');
  for (int i = 0; i < n; i++) {
    int pos = arr[i] - 1;
    if (abs(pos - i) == abs(cumOnes[pos] - cumOnes[i]))
      continue;
    else
      goto exit;
  }
  printf("YES");
  return 0;
exit:
  printf("NO");
  return 0;
}
