#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
int A[MAXN];
int main() {
  int N, M, T;
  while (cin >> N) {
    for (int i = (0); i < (N); i++) scanf("%d", &A[i]);
    int l = 0;
    bool flag = true;
    for (int r = (1); r < (N); r++) {
      char b;
      scanf("\n%c", &b);
      if (b == '0') {
        flag = flag && (*max_element(A + l, A + r) == r);
        flag = flag && (*min_element(A + l, A + r) == l + 1);
        l = r;
      }
    }
    int r = N;
    flag = flag && (*max_element(A + l, A + r) == r);
    flag = flag && (*min_element(A + l, A + r) == l + 1);
    if (flag)
      cout << "YES";
    else
      cout << "NO";
    cout << endl;
  }
  return 0;
}
