#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int main() {
  int n;
  cin >> n;
  int arr[n + 1];
  v.push_back(0);
  string x;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  cin >> x;
  for (int i = 0; i < n - 1; i++) {
    if (x[i] == '0' && arr[i + 1] > i + 1) {
      cout << "NO\n";
      return 0;
    }
    if (x[i] == '0') v.push_back(i + 1);
  }
  v.push_back(n);
  for (int i = 0; i < v.size() - 1; i++) {
    int temp1 = v[i];
    int temp2 = v[i + 1];
    int count = 0;
    for (int j = temp1 + 1; j <= temp2; j++) {
      if (arr[j] > temp1 && arr[j] <= temp2) count++;
    }
    if (count != (temp2 - temp1)) {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
  return 0;
}
