#include <bits/stdc++.h>
long long gi() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) f ^= ch == '-', ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return f ? x : -x;
}
std::mt19937 rnd(time(NULL));
template <class T>
void cxk(T& a, T b) {
  a = a > b ? a : b;
}
template <class T>
void cnk(T& a, T b) {
  a = a < b ? a : b;
}
int n, le, lo, A[200010];
struct qwq {
  long long mn0, mn1, sum;
  bool len;
} seg[524389];
long long tag[524389];
qwq operator+(const qwq& a, const qwq& b) {
  qwq c;
  c.len = a.len ^ b.len;
  c.sum = b.sum + (b.len ? -1 : 1) * a.sum;
  if (a.len)
    c.mn0 = std::min(a.mn0, b.mn1 + a.sum),
    c.mn1 = std::min(a.mn1, b.mn0 - a.sum);
  else
    c.mn0 = std::min(a.mn0, b.mn0 - a.sum),
    c.mn1 = std::min(a.mn1, b.mn1 + a.sum);
  return c;
}
void upd(int x, long long d) {
  seg[x].mn0 += d, tag[x] += d;
  if (seg[x].len) seg[x].sum += d;
}
void down(int x) {
  if (tag[x]) upd(x << 1, tag[x]), upd(x << 1 | 1, tag[x]), tag[x] = 0;
}
void build(int x, int l, int r) {
  if (l == r) {
    seg[x] = {A[l], 1ll << 60, A[l], 1};
    return;
  }
  build(x << 1, l, ((l + r) >> 1)), build(x << 1 | 1, ((l + r) >> 1) + 1, r);
  seg[x] = seg[x << 1] + seg[x << 1 | 1];
}
void update(int x, int l, int r, int L, int R, long long d) {
  if (L <= l && r <= R) return upd(x, d);
  down(x);
  if (L <= ((l + r) >> 1)) update(x << 1, l, ((l + r) >> 1), L, R, d);
  if (((l + r) >> 1) < R) update(x << 1 | 1, ((l + r) >> 1) + 1, r, L, R, d);
  seg[x] = seg[x << 1] + seg[x << 1 | 1];
}
qwq query(int x, int l, int r, int L, int R) {
  if (L <= l && r <= R) return seg[x];
  down(x);
  if (L <= ((l + r) >> 1))
    if (((l + r) >> 1) < R)
      return query(x << 1, l, ((l + r) >> 1), L, R) +
             query(x << 1 | 1, ((l + r) >> 1) + 1, r, L, R);
    else
      return query(x << 1, l, ((l + r) >> 1), L, R);
  else
    return query(x << 1 | 1, ((l + r) >> 1) + 1, r, L, R);
}
int main() {
  n = gi();
  for (int i = 1; i <= n; ++i) A[i] = gi() - 1;
  build(1, 1, n);
  int q = gi(), o, l, r;
  while (q--) {
    o = gi(), l = gi() + 1, r = gi() + 1;
    if (o == 1)
      update(1, 1, n, l, r, gi());
    else {
      qwq s = query(1, 1, n, l, r);
      puts((s.mn0 >= 0 && s.mn1 >= 0 && !s.sum) ? "1" : "0");
    }
  }
  return 0;
}
