#include <bits/stdc++.h>
using namespace std;
const int inf = 1e8;
long long n, m, k;
vector<int> v;
string s;
int ind[200002];
int pref[200002];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i < n + 1; i++) {
    int x;
    cin >> x;
    ind[x] = i;
  }
  cin >> s;
  for (int i = 1; i < n; i++) {
    pref[i] = s[i - 1] - '0';
    pref[i] += pref[i - 1];
  }
  for (int i = 1; i < n + 1; i++) {
    if (i < ind[i]) {
      if (pref[ind[i] - 1] - pref[i - 1] < ind[i] - i) {
        cout << "NO"
             << "\n";
        return 0;
      }
    }
    if (i > ind[i]) {
      if (pref[i - 1] - pref[ind[i] - 1] < i - ind[i]) {
        cout << "NO"
             << "\n";
        return 0;
      }
    }
  }
  cout << "YES"
       << "\n";
  return 0;
}
