#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
inline int Gcd(int X, int Y) { return Y ? Gcd(Y, X % Y) : X; }
inline long long Gcd(long long X, long long Y) { return Y ? Gcd(Y, X % Y) : X; }
inline int Max(int X, int Y) { return X < Y ? Y : X; }
inline int Min(int X, int Y) { return X < Y ? X : Y; }
inline long long Max(long long X, long long Y) { return X < Y ? Y : X; }
inline long long Min(long long X, long long Y) { return X < Y ? X : Y; }
inline int Pow(int base, long long exp, int _mod) {
  int _ans = 1;
  for (; exp; exp >>= 1, base = (long long)base * base % _mod)
    exp& 1 ? _ans = (long long)_ans * base % _mod : 0;
  return _ans;
}
inline long long Pow(long long base, long long exp, long long _mod) {
  long long _ans = 1;
  for (; exp; exp >>= 1, base = base * base % _mod)
    exp& 1 ? _ans = _ans * base % _mod : 0;
  return _ans;
}
int n, q;
int a[200001], b[200001];
int main() {
  scanf("%d", &n);
  for (int i = (1); i <= (n); ++i) scanf("%d", a + i);
  char ch;
  for (int i = (1); i < (n); ++i)
    if ((ch = getchar()) != '1' && ch != '0')
      --i;
    else
      b[i] = ch - '0';
  int lst = 1;
  for (int i = (1); i <= (n); ++i) {
    if (!b[i]) sort(a + lst, a + i + 1), lst = i + 1;
  }
  sort(a + lst, a + n + 1);
  for (int i = (1); i <= (n); ++i)
    if (a[i] != i) {
      puts("NO");
      return 0;
    }
  puts("YES");
  return 0;
}
