#include <bits/stdc++.h>
using namespace std;
long long int a[1000000], b[1000000];
long long int dfs(long long int x) { return abs(x); }
int main() {
  long long int i, j, k, n, m, x, y, kk = 0;
  cin >> n;
  string c;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    kk++;
  }
  cin >> c;
  for (i = 0; i < c.size(); i++) {
    if (c[i] == '0')
      b[i + 1] = 0;
    else
      b[i + 1] = 1;
  }
  long long int pp = 0;
  for (i = 1; i <= n - 1; i++) {
    b[i] = b[i] + b[i - 1];
    pp--;
  }
  for (i = 1; i <= n; i++) {
    if (a[i] != i) {
      k = dfs(a[i] - i);
      if (dfs(b[a[i] - 1] - b[i - 1]) < k) {
        cout << "NO";
        return 0;
      }
    }
  }
  cout << "YES";
}
