#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
template <class T, class U>
inline void Max(T &a, U b) {
  if (a < b) a = b;
}
template <class T, class U>
inline void Min(T &a, U b) {
  if (a > b) a = b;
}
inline void add(int &a, int b) {
  a += b;
  while (a >= 1000000007) a -= 1000000007;
}
int pow(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = ans * (long long)a % 1000000007;
    a = (long long)a * a % 1000000007;
    b >>= 1;
  }
  return ans;
}
struct data {
  int s[2], f[2], mi, len;
  data() {}
  data(int v) {
    s[0] = f[0] = v, s[1] = -v;
    f[1] = 2 * 1000000007;
    mi = v;
    len = 1;
  }
} t[200010 << 2];
inline data operator+(const data &a, const data &b) {
  data c;
  int k = a.len & 1;
  c.s[0] = a.s[0] + b.s[k], c.s[1] = a.s[1] + b.s[k ^ 1];
  c.f[0] = min(a.f[0], a.s[0] + b.f[k]),
  c.f[1] = min(a.f[1], a.s[1] + b.f[k ^ 1]);
  c.mi = min(c.f[0], c.f[1] + 1);
  c.len = a.len + b.len;
  return c;
}
int c[200010 << 2], a[200010];
void build(int p, int l, int r) {
  if (l == r) {
    t[p] = data(a[l]);
    return;
  }
  int m = (l + r) >> 1;
  build(p << 1, l, m);
  build(p << 1 | 1, m + 1, r);
  t[p] = t[p << 1] + t[p << 1 | 1];
}
void cal(int p, int v) {
  c[p] += v;
  int k = t[p].len & 1;
  t[p].s[0] += k * v;
  t[p].s[1] -= k * v;
  t[p].f[0] += v;
  t[p].mi = min(t[p].f[0], t[p].f[1] + 1);
}
void down(int p) {
  if (c[p]) {
    cal(p << 1, c[p]);
    cal(p << 1 | 1, c[p]);
    c[p] = 0;
  }
}
void upd(int p, int l, int r, int first, int second, int v) {
  if (l >= first && r <= second) {
    cal(p, v);
    return;
  }
  int m = (l + r) >> 1;
  down(p);
  if (first <= m) upd(p << 1, l, m, first, second, v);
  if (second > m) upd(p << 1 | 1, m + 1, r, first, second, v);
  t[p] = t[p << 1] + t[p << 1 | 1];
}
data query(int p, int l, int r, int first, int second) {
  if (l >= first && r <= second) return t[p];
  int m = (l + r) >> 1;
  down(p);
  data ans;
  if (second <= m)
    ans = query(p << 1, l, m, first, second);
  else if (first > m)
    ans = query(p << 1 | 1, m + 1, r, first, second);
  else {
    data ans1;
    ans = query(p << 1, l, m, first, m),
    ans1 = query(p << 1 | 1, m + 1, r, m + 1, second);
    ans = ans + ans1;
  }
  return ans;
}
int main() {
  int i, j, k = 0, ca = 0, T, K, m = 0, n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  build(1, 0, n - 1);
  scanf("%d", &m);
  int l, r;
  while (m--) {
    scanf("%d%d%d", &k, &l, &r);
    if (k == 1) {
      scanf("%d", &k);
      upd(1, 0, n - 1, l, r, k);
    } else {
      if (l == r) {
        if (query(1, 0, n - 1, r, r).s[0] != 1)
          puts("0");
        else
          puts("1");
        continue;
      }
      data ans = query(1, 0, n - 1, l, r - 1), ans1 = query(1, 0, n - 1, r, r);
      if (ans.mi < 1) {
        puts("0");
        continue;
      }
      j = ans.len & 1 ? ans.s[0] : ans.s[1] + 1;
      if (j != ans1.s[0])
        puts("0");
      else
        puts("1");
    }
  }
  return 0;
}
