#include <bits/stdc++.h>
using namespace std;
const long long int mx = 100000;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int a[200005];
  unordered_map<int, int> m;
  int swap[200005];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    m[a[i]] = i;
  }
  string s;
  cin >> s;
  swap[1] = 0;
  for (int i = 2; i <= n; i++) {
    if (s[i - 2] == '0')
      swap[i] = 0;
    else
      swap[i] = swap[i - 1] + 1;
  }
  string ans = "YES";
  for (int i = 1; i <= n; i++) {
    if (m[i] <= i)
      continue;
    else {
      int x = m[i];
      if ((x - i) != swap[x] - swap[i]) {
        ans = "NO";
        break;
      }
    }
  }
  cout << ans << endl;
}
