#include <bits/stdc++.h>
using namespace std;
int ara[200005];
string ss;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> ara[i];
  }
  cin >> ss;
  int maxi = 0;
  for (int i = 0; i < n; i++) {
    maxi = max(maxi, ara[i]);
    if (ss[i] == '0') {
      if (maxi != i + 1) {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  cout << "YES" << endl;
  return 0;
}
