#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:102400000,102400000")
const int N = 200005;
int n, a[N];
char s[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  scanf("%s", s + 1);
  int mx = 0;
  for (int i = 1; i <= n - 1; ++i) {
    mx = max(mx, a[i]);
    if (s[i] == '0') {
      if (mx > i) return 0 * printf("NO");
    }
  }
  puts("YES");
  return 0;
}
