#include <bits/stdc++.h>
using namespace std;
const int N = (2e5 + 5);
int n;
int a[N];
int p[N];
string s;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    p[i + 1] = p[i];
    if (s[i] == '1') p[i + 1]++;
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] > i) {
      if (p[a[i] - 1] - p[i - 1] != (a[i] - i)) {
        puts("NO");
        return 0;
      }
    } else {
      if (p[i - 1] - p[a[i] - 1] != (i - a[i])) {
        puts("NO");
        return 0;
      }
    }
  }
  puts("YES");
  return 0;
}
