#include <bits/stdc++.h>
using namespace std;
int num[200005];
string s;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> num[i];
  cin >> s;
  bool flag = true;
  for (int i = 0, j = 0; i < n - 1; i++) {
    if (s[i] == '1') continue;
    for (; j <= i; j++) {
      if (num[j] > i + 1) {
        flag = false;
        break;
      }
    }
    if (!flag) break;
  }
  if (flag)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
