#include <bits/stdc++.h>
using namespace std;
long long n, a[200005];
long long preff[200005];
string s;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  cin >> s;
  for (long long i = 1; i <= n; ++i) {
    preff[i] = preff[i - 1] + (s[i - 1] == '1');
  }
  for (long long i = 1; i <= n; ++i) {
    if (preff[a[i] - 1] - preff[i - 1] != (a[i] - 1 - (i - 1))) {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
}
