#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int n, q;
int c[maxn], a[maxn];
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  return x * f;
}
struct base {
  int p[31];
  void insert(int val) {
    for (register int i = 30; ~i; i--) {
      if (val >> i & 1) {
        if (!p[i]) {
          p[i] = val;
          break;
        }
        val ^= p[i];
      }
    }
  }
  void clear() { memset(p, 0, sizeof(p)); }
  long long solve() {
    long long res = 1;
    for (register int i = 30; i >= 0; i--)
      if (p[i]) res = res * 2;
    return res;
  }
} ans, s[maxn << 2];
base merge(base x, base y) {
  base res = x;
  for (register int i = 30; ~i; i--)
    if (y.p[i]) res.insert(y.p[i]);
  return res;
}
void update(int rt, int l, int r, int x, int val) {
  if (l == r) {
    s[rt].clear();
    s[rt].insert(val);
    return;
  }
  int mid = (l + r) >> 1;
  if (x <= mid)
    update(rt << 1, l, mid, x, val);
  else
    update(rt << 1 | 1, mid + 1, r, x, val);
  s[rt] = merge(s[rt << 1], s[rt << 1 | 1]);
}
void query(int rt, int l, int r, int ql, int qr) {
  if (ql <= l && r <= qr) {
    ans = merge(ans, s[rt]);
    return;
  }
  int mid = (l + r) >> 1;
  if (ql <= mid) query(rt << 1, l, mid, ql, qr);
  if (qr > mid) query(rt << 1 | 1, mid + 1, r, ql, qr);
}
int lowbit(int x) { return x & (-x); }
void add(int x, int y) {
  for (register int i = x; i <= n; i += lowbit(i)) c[i] ^= y;
}
int getval(int x) {
  int res = 0;
  for (register int i = x; i; i -= lowbit(i)) res ^= c[i];
  return res;
}
int main() {
  int l, r, x, opt;
  n = read();
  q = read();
  for (register int i = 1; i <= n; i++) a[i] = read();
  for (register int i = n; i >= 2; i--) a[i] ^= a[i - 1];
  for (register int i = 1; i <= n; i++) {
    update(1, 1, n, i, a[i]);
    add(i, a[i]);
  }
  while (q--) {
    opt = read();
    if (opt == 1) {
      l = read();
      r = read();
      x = read();
      add(l, x);
      update(1, 1, n, l, a[l] ^= x);
      if (r < n) {
        add(r + 1, x);
        update(1, 1, n, r + 1, a[r + 1] ^= x);
      }
    } else {
      l = read();
      r = read();
      int k = getval(l);
      ans.clear();
      ans.insert(k);
      query(1, 1, n, l + 1, r);
      printf("%lld\n", ans.solve());
    }
  }
  return 0;
}
