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