#include <bits/stdc++.h>
using namespace std;
const long long M = 1e6 + 10, MOD = 1000000007;
int pos[M];
int sum[M];
string s;
int a;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a, pos[a] = i;
  cin >> s;
  for (int i = 1; i <= s.size(); i++) {
    sum[i] = sum[i - 1] + (s[i - 1] == '1');
  }
  for (int i = 1; i < n; i++) {
    if (pos[i] == i)
      continue;
    else {
      int a = pos[i];
      int b = i;
      if (a > b) swap(a, b);
      a--;
      b--;
      int c = sum[b] - sum[a];
      if (c == b - a) continue;
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  return 0;
}
