#include <bits/stdc++.h>
template <typename T>
bool domax(T &a, T b) {
  return (b > a ? (a = b, true) : false);
}
template <typename T>
bool domin(T &a, T b) {
  return (b < a ? (a = b, true) : false);
}
const int Max = 1 << 18, MaxNodes = 1 << 19;
std::vector<long long> mins0, mins1, sums;
struct rt_t {
  long long lazy[MaxNodes];
  long long sum[MaxNodes];
  long long min0[MaxNodes];
  long long min1[MaxNodes];
  void unlazy(int n, int nl, int nr) {
    long long &k = lazy[n];
    if (k) {
      if (nl + 1 == nr) {
        if (nl & 1) {
          sum[n] -= k;
          min1[n] += k;
        } else {
          sum[n] += k;
          min0[n] += k;
        }
      } else {
        min0[n] += k;
        lazy[(n * 2 + 1)] += k;
        lazy[(n * 2 + 2)] += k;
      }
      k = 0;
    }
  }
  void u(int n, int nl, int nr, int ul, int ur, long long uv) {
    unlazy(n, nl, nr);
    if (ul <= nl && nr <= ur) {
      lazy[n] += uv;
    } else {
      if (ul < ((nl + nr) / 2)) u((n * 2 + 1), nl, ((nl + nr) / 2), ul, ur, uv);
      if (((nl + nr) / 2) < ur) u((n * 2 + 2), ((nl + nr) / 2), nr, ul, ur, uv);
      unlazy((n * 2 + 1), nl, ((nl + nr) / 2));
      unlazy((n * 2 + 2), ((nl + nr) / 2), nr);
      sum[n] = sum[(n * 2 + 1)] + sum[(n * 2 + 2)];
      min0[n] =
          std::min(min0[(n * 2 + 1)], sum[(n * 2 + 1)] + min0[(n * 2 + 2)]);
      min1[n] =
          std::min(min1[(n * 2 + 1)], -sum[(n * 2 + 1)] + min1[(n * 2 + 2)]);
    }
  }
  void query(int n, int nl, int nr, int ql, int qr) {
    unlazy(n, nl, nr);
    if (ql <= nl && nr <= qr) {
      mins0.push_back(min0[n]);
      mins1.push_back(min1[n]);
      sums.push_back(sum[n]);
    } else {
      if (ql < ((nl + nr) / 2)) query((n * 2 + 1), nl, ((nl + nr) / 2), ql, qr);
      if (((nl + nr) / 2) < qr) query((n * 2 + 2), ((nl + nr) / 2), nr, ql, qr);
    }
  }
} rt;
int solve(int ql, int qr) {
  sums.clear();
  mins0.clear();
  mins1.clear();
  rt.query(0, 0, Max, ql, qr);
  long long s = 0;
  for (int i = 0; i < (int((sums).size())); i++) {
    if (s + mins0[i] < 0) return 0;
    if (-s + mins1[i] < 0) return 0;
    s += sums[i];
  }
  return s ? 0 : 1;
}
int n, q;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    long long a;
    scanf("%lld", &a);
    rt.u(0, 0, Max, i, i + 1, a - 1);
  }
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    int c, a, b;
    scanf("%d%d%d", &c, &a, &b);
    b++;
    if (c == 1) {
      long long k;
      scanf("%lld", &k);
      rt.u(0, 0, Max, a, b, k);
    } else
      printf("%d\n", solve(a, b));
  }
}
