#include <bits/stdc++.h>
using namespace std;
struct gs {
  int l[65];
  int ls;
  gs() { ls = 0; }
  void gauss() {
    int r = 0;
    for (int i = 31; i >= 0 && r < ls; i--) {
      for (int j = (r); j < (ls); j++)
        if (l[j] & (1 << i)) swap(l[j], l[r]);
      if (!(l[r] & (1 << i))) continue;
      for (int j = (r + 1); j < (ls); j++)
        if (l[j] & (1 << i)) l[j] ^= l[r];
      r++;
    }
    ls = r;
  }
  void addnum(int x) {
    l[ls++] = x;
    gauss();
  }
  long long cnt() { return 1ll << ls; }
};
void merge(gs &a, const gs &b) {
  for (int i = (0); i < (b.ls); i++) a.l[a.ls++] = b.l[i];
  a.gauss();
}
void axor(gs &a, int k) {
  for (int i = (0); i < (a.ls); i++)
    if (a.l[i] & 1) a.l[i] ^= k << 1;
  a.gauss();
}
gs rt[4 * 200005];
int d[4 * 200005];
gs q(int i, int rs, int re, int qs, int qe) {
  if (rs == qs && re == qe) {
    return rt[i];
  } else {
    int md = (rs + re) / 2;
    gs res;
    res.ls = 0;
    if (qs < md) merge(res, q(2 * i + 1, rs, md, qs, min(qe, md)));
    if (qe > md) merge(res, q(2 * i + 2, md, re, max(qs, md), qe));
    axor(res, d[i]);
    return res;
  }
}
int initv[200005];
void u2(int i, int rs, int re) {
  if (rs + 1 == re) {
    rt[i].addnum(initv[rs] * 2 + 1);
  } else {
    int md = (rs + re) / 2;
    u2(2 * i + 1, rs, md);
    u2(2 * i + 2, md, re);
    rt[i] = rt[2 * i + 1];
    merge(rt[i], rt[2 * i + 2]);
  }
}
void u(int i, int rs, int re, int qs, int qe, int dv) {
  if (rs == qs && re == qe) {
    axor(rt[i], dv);
    d[i] ^= dv;
  } else {
    int md = (rs + re) / 2;
    if (qs < md) u(2 * i + 1, rs, md, qs, min(qe, md), dv);
    if (qe > md) u(2 * i + 2, md, re, max(qs, md), qe, dv);
    rt[i] = rt[2 * i + 1];
    merge(rt[i], rt[2 * i + 2]);
    axor(rt[i], d[i]);
  }
}
int n, Q;
int main() {
  scanf("%d%d", &n, &Q);
  for (int i = (0); i < (n); i++) {
    int v;
    scanf("%d", &v);
    initv[i] = v;
  }
  u2(0, 0, n);
  for (int z = (0); z < (Q); z++) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      int l, r, k;
      scanf("%d%d%d", &l, &r, &k);
      l--;
      u(0, 0, n, l, r, k);
    } else {
      int l, r;
      scanf("%d%d", &l, &r);
      l--;
      gs g = q(0, 0, n, l, r);
      for (int i = (0); i < (g.ls); i++) g.l[i] /= 2;
      g.gauss();
      printf("%lld\n", g.cnt());
    }
  }
}
