#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  string s;
  cin >> s;
  long long int m = 0;
  for (long long int i = 0; i < n; i++) {
    m = max(m, a[i]);
    if (s[i] == '0' && m > i + 1) {
      cout << "NO" << endl;
      return;
    }
  }
  cout << "YES" << endl;
}
void c_p_c() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int32_t main() {
  c_p_c();
  solve();
  return 0;
}
