#include <bits/stdc++.h>
using namespace std;
struct tafin {
  int b[30];
  int nb;
  int p;
  int e;
  tafin() { p = nb = e = 0; }
};
int n;
int m[100];
void fusiona(tafin &afin0, tafin &afin1, tafin &afin) {
  n = 0;
  for (int i = 0; i < afin0.nb; i++) m[n++] = afin0.b[i];
  int s = afin0.p ^ afin0.e ^ afin1.p ^ afin1.e;
  m[n++] = s;
  for (int i = 0; i < afin1.nb; i++) m[n++] = afin1.b[i] ^ s;
  int i = 0, j = 0;
  while (i < n and j < 30) {
    int ii = i;
    while (ii < n and (m[ii] & (1 << j)) == 0) ii++;
    if (ii < n) {
      swap(m[i], m[ii]);
      for (ii = i + 1; ii < n; ii++)
        if (m[ii] & (1 << j)) m[ii] ^= m[i];
      i++;
      j++;
    } else
      j++;
  }
  afin.p = afin0.p ^ afin0.e;
  for (int ii = 0; ii < i; ii++) afin.b[ii] = m[ii];
  afin.nb = i;
}
const int tope = 1 << 19;
const int primero = 1 << 18;
tafin v[tope];
void recalcula(int pos) { fusiona(v[2 * pos], v[2 * pos + 1], v[pos]); }
void inserta(int pos0, int pos1, int val) {
  pos0 += primero;
  pos1 += primero;
  if (pos0 == pos1) {
    v[pos0].e ^= val;
  } else {
    v[pos0].e ^= val;
    v[pos1].e ^= val;
    while (pos0 / 2 != pos1 / 2) {
      if (pos0 % 2 == 0) v[pos0 + 1].e ^= val;
      pos0 /= 2;
      recalcula(pos0);
      if (pos1 % 2 == 1) v[pos1 - 1].e ^= val;
      pos1 /= 2;
      recalcula(pos1);
    }
  }
  while (pos0 > 1) {
    pos0 /= 2;
    recalcula(pos0);
  }
}
tafin afin0, afin1, afinaux, afinsingle;
int calcula(int pos0, int pos1) {
  pos0 += primero;
  pos1 += primero;
  afin0 = v[pos0];
  if (pos0 != pos1) {
    afin1 = v[pos1];
    while (pos0 / 2 < pos1 / 2) {
      if (pos0 % 2 == 0) {
        fusiona(afin0, v[pos0 + 1], afinaux);
        afin0 = afinaux;
      }
      pos0 /= 2;
      afin0.e ^= v[pos0].e;
      if (pos1 % 2 == 1) {
        fusiona(afin1, v[pos1 - 1], afinaux);
        afin1 = afinaux;
      }
      pos1 /= 2;
      afin1.e ^= v[pos1].e;
    }
    fusiona(afin0, afin1, afinaux);
    afin0 = afinaux;
  }
  while (pos0 > 1) {
    pos0 /= 2;
    afin0.e ^= v[pos0].e;
  }
  fusiona(afin0, afinsingle, afinaux);
  return 1 << afinaux.nb;
}
int main() {
  ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    inserta(i, i, a);
  }
  for (int caso = 0; caso < q; caso++) {
    int tipo;
    cin >> tipo;
    if (tipo == 1) {
      int l, r, k;
      cin >> l >> r >> k;
      inserta(l, r, k);
    } else {
      int l, r;
      cin >> l >> r;
      cout << calcula(l, r) << endl;
    }
  }
}
