#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const long long int INF = 1e18;
const int N = 100005;
const int MOD = 1e9 + 7;
const double EPS = 1e-6;
const double PI = acos(-1.0);
int ara[2 * N];
vector<pair<int, int> > V;
int n;
bool ok() {
  for (int i = 2; i <= n; i++) {
    if (ara[i] == ara[i - 1] + 1)
      continue;
    else
      return false;
  }
  return true;
}
int main(int argc, char const *argv[]) {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> ara[i];
  }
  string str;
  cin >> str;
  if (ok()) {
    puts("YES");
    return 0;
  }
  str += '0';
  for (int i = 0; i < str.size();) {
    if (str[i] == '1') {
      int l = i + 1;
      int r = l;
      while (str[i] == '1') {
        i++;
        r++;
      }
      V.push_back({l, r});
    } else
      i++;
  }
  for (auto x : V) {
    sort(ara + x.first, ara + x.second + 1);
  }
  if (ok())
    puts("YES");
  else
    puts("NO");
  return 0;
}
