#include <bits/stdc++.h>
using namespace std;
int a[200005];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int mx = -1;
  char ch;
  for (int i = 1; i < n; i++) {
    cin >> ch;
    mx = max(a[i], mx);
    if (ch == '0')
      if (mx > i) {
        cout << "NO";
        return 0;
      }
  }
  cout << "YES";
}
