#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
const long long mod = 1e11 + 7;
const int N = 1e6 + 10;
const long long INF = 1e18;
long long power(long long x, long long y) {
  long long t = 1;
  while (y > 0) {
    if (y % 2)
      y -= 1, t = t * x % mod;
    else
      y /= 2, x = x * x % mod;
  }
  return t;
}
long long arr[N];
struct node {
  int sz;
  long long mio, mie, sum;
} tree[3 * N];
long long lazy[6 * N];
int tp = 3 * N - 1;
void combine(node &C, node &l, node &r) {
  C.sz = l.sz + r.sz;
  C.sum = r.sum + ((r.sz % 2) ? -1 : 1) * l.sum;
  C.mio = r.mio - l.sum;
  C.mie = r.mie + l.sum;
  if (l.sz % 2) {
    swap(C.mio, C.mie);
  }
  C.mio = min(C.mio, l.mio);
  C.mie = min(C.mie, l.mie);
}
void build(int C, int l, int r) {
  tree[C].sz = r - l + 1;
  if (l == r) {
    tree[C].sum = arr[l];
    tree[C].mio = arr[l];
    tree[C].mie = mod;
    return;
  }
  int m = (l + r) >> 1;
  build(C * 2, l, m);
  build(C * 2 + 1, m + 1, r);
  combine(tree[C], tree[C * 2], tree[C * 2 + 1]);
}
void push(int C) {
  if (lazy[C]) {
    tree[C].mio += lazy[C];
    if (tree[C].sz % 2) tree[C].sum += lazy[C];
    lazy[C * 2 + 1] += lazy[C];
    lazy[C * 2] += lazy[C];
  }
  lazy[C] = 0;
}
void upd(int C, int S, int E, int s, int e, long long k) {
  push(C);
  if (s > E || e < S) return;
  if (s <= S && e >= E) {
    lazy[C] += k;
    push(C);
    return;
  }
  int m = (S + E) >> 1;
  upd(C * 2, S, m, s, e, k);
  upd(C * 2 + 1, m + 1, E, s, e, k);
  combine(tree[C], tree[C * 2], tree[C * 2 + 1]);
}
node query(int C, int S, int E, int s, int e) {
  push(C);
  if (S == s && E == e) return tree[C];
  int m = (S + E) >> 1;
  if (e <= m) return query(C * 2, S, m, s, e);
  if (s > m) return query(C * 2 + 1, m + 1, E, s, e);
  node a = query(C * 2, S, m, s, m), b = query(C * 2 + 1, m + 1, E, m + 1, e);
  node c;
  combine(c, a, b);
  return c;
}
void print(node a) {
  printf("node min odd %lld min even %lld sum %lld\n", a.mio, a.mie, a.sum);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%lld", &arr[i]);
  build(1, 0, n - 1);
  int q;
  scanf("%d", &q);
  while (q--) {
    int c;
    scanf("%d", &c);
    if (c == 1) {
      int l, r, k;
      scanf("%d%d%d", &l, &r, &k);
      upd(1, 0, n - 1, l, r, k);
    } else {
      int l, r;
      scanf("%d%d", &l, &r);
      if (l == r) {
        node a = query(1, 0, n - 1, l, r);
        if (a.sum != 1)
          printf("0\n");
        else
          printf("1\n");
      } else {
        node a = query(1, 0, n - 1, l, r - 1);
        node b = query(1, 0, n - 1, l, r);
        int f = 1;
        if (a.mio <= 0 || a.mie < 0) f = 0;
        if (b.sz % 2 == 1) {
          if (b.sum != 1) f = 0;
        } else {
          if (b.sum != 0) f = 0;
        }
        printf("%d\n", f);
      }
    }
  }
  return 0;
}
