#include <bits/stdc++.h>
using namespace std;
const int iL = 666666;
char *iS, *iT, ibuf[iL];
inline char gc() {
  if (iS == iT) {
    iT = (iS = ibuf) + fread(ibuf, 1, iL, stdin);
    return iS == iT ? EOF : *iS++;
  }
  return *iS++;
}
template <class I>
void gi(I &x) {
  static char c;
  static int f;
  for (f = 1, c = getchar(); c < '0' || c > '9'; c = getchar())
    if (c == '-') f = -1;
  for (x = 0; c <= '9' && c >= '0'; c = getchar()) x = x * 10 + (c & 15);
  x *= f;
}
const int N = 200050;
int Ttag[N * 4], Tval[N * 4], T[N * 4][31];
int n, q, sig, d, l, r;
int cnt(int x) {
  int ans = 0;
  for (int i = 0; i <= 30; i++)
    if (T[x][i]) ans++;
  return ans;
}
void clear(int x) {
  for (int i = 0; i <= 30; i++) T[x][i] = 0;
  Tval[x] = Ttag[x] = 0;
}
void add(int d, int x) {
  for (int i = 30; i >= 0; i--)
    if ((d >> i) & 1) {
      if (T[x][i])
        d ^= T[x][i];
      else {
        T[x][i] = d;
        break;
      }
    }
}
void Complex(int x, int lc, int rc) {
  clear(x);
  for (int i = 0; i <= 30; i++) add(T[lc][i], x), add(T[rc][i], x);
  add(Tval[lc] ^ Tval[rc], x);
  Tval[x] = Tval[lc];
}
void Complex2(int x, int rc) {
  clear(N * 4 - 1);
  for (int i = 0; i <= 30; i++)
    add(T[x][i], N * 4 - 1), add(T[rc][i], N * 4 - 1);
  add(Tval[x] ^ Tval[rc], N * 4 - 1);
  Tval[N * 4 - 1] = Tval[x];
  for (int i = 0; i <= 30; i++) T[x][i] = T[N * 4 - 1][i];
  Tval[x] = Tval[N * 4 - 1];
}
void build(int x, int l, int r) {
  clear(x);
  if (l == r) {
    gi(Tval[x]);
    return;
  }
  int mid = (l + r) >> 1;
  build(x << 1, l, mid);
  build(x << 1 | 1, mid + 1, r);
  Complex(x, x << 1, x << 1 | 1);
}
void push_down(int x) {
  int lc = x << 1, rc = x << 1 | 1;
  if (Ttag[x]) {
    Ttag[lc] ^= Ttag[x];
    Ttag[rc] ^= Ttag[x];
    Tval[lc] ^= Ttag[x];
    Tval[rc] ^= Ttag[x];
    Ttag[x] = 0;
  }
}
void change(int x, int l, int r, int lb, int rb, int d) {
  if (lb <= l && r <= rb) {
    Tval[x] ^= d;
    Ttag[x] ^= d;
    return;
  }
  push_down(x);
  int mid = (l + r) >> 1;
  if (lb <= mid) change(x << 1, l, mid, lb, rb, d);
  if (rb > mid) change(x << 1 | 1, mid + 1, r, lb, rb, d);
  Complex(x, x << 1, x << 1 | 1);
}
void query(int x, int l, int r, int lb, int rb) {
  if (lb <= l && r <= rb) {
    Complex2(0, x);
    return;
  }
  push_down(x);
  int mid = (l + r) >> 1;
  if (lb <= mid) query(x << 1, l, mid, lb, rb);
  if (rb > mid) query(x << 1 | 1, mid + 1, r, lb, rb);
  Complex(x, x << 1, x << 1 | 1);
}
int main() {
  gi(n);
  gi(q);
  build(1, 1, n);
  while (q--) {
    gi(sig);
    if (sig == 1) {
      gi(l);
      gi(r);
      gi(d);
      change(1, 1, n, l, r, d);
    } else {
      gi(l);
      gi(r);
      clear(0);
      query(1, 1, n, l, r);
      printf("%d\n", (1 << cnt(0)));
    }
  }
  return 0;
}
