#include <bits/stdc++.h>
using namespace std;
inline int gi() {
  char c;
  int num = 0, flg = 1;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') flg = -1;
  while (c >= '0' && c <= '9') {
    num = num * 10 + c - 48;
    c = getchar();
  }
  return num * flg;
}
int bastmp[29 + 2], cnttmp;
struct node {
  int l, r, bas[29 + 1], cnt, la;
  int val;
  void add(int x) {
    for (int i = 29; i >= 0; i--)
      if (x & (1 << i)) {
        if (!bas[i]) {
          bas[i] = x, cnt++;
          return;
        } else {
          x ^= bas[i];
          if (!x) return;
        }
      }
  }
} a[200005 << 2];
int val[200005];
void pushup(int i) {
  int LC = i << 1, RC = i << 1 | 1;
  if (a[LC].cnt < a[RC].cnt) swap(LC, RC);
  a[i].cnt = a[LC].cnt;
  for (int j = 29; j >= 0; j--) a[i].bas[j] = a[LC].bas[j];
  for (int j = 29; j >= 0; j--)
    if (a[RC].bas[j]) a[i].add(a[RC].bas[j]);
  a[i].add(a[LC].val ^ a[RC].val);
  a[i].val = a[i << 1 | 1].val;
}
void pushdown(int i) {
  if (a[i].la) {
    a[i << 1].val ^= a[i].la;
    a[i << 1].la ^= a[i].la;
    a[i << 1 | 1].val ^= a[i].la;
    a[i << 1 | 1].la ^= a[i].la;
    a[i].la = 0;
  }
}
void build(int i, int l, int r) {
  a[i].l = l;
  a[i].r = r;
  if (l == r) {
    a[i].val = val[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(i << 1, l, mid);
  build(i << 1 | 1, mid + 1, r);
  pushup(i);
}
void insert(int i, int l, int r, int k) {
  if (a[i].l > r || a[i].r < l) return;
  if (l <= a[i].l && a[i].r <= r) {
    a[i].val ^= k;
    a[i].la ^= k;
    return;
  }
  pushdown(i);
  insert(i << 1, l, r, k);
  insert(i << 1 | 1, l, r, k);
  pushup(i);
}
void query(int i, int l, int r) {
  if (a[i].l > r || a[i].r < l) return;
  if (l <= a[i].l && a[i].r <= r) {
    for (int j = 29; j >= 0; j--)
      if (a[i].bas[j]) a[0].add(a[i].bas[j]);
    a[0].add(a[0].val ^ a[i].val);
    a[0].val = a[i].val;
    return;
  }
  pushdown(i);
  query(i << 1, l, r);
  query(i << 1 | 1, l, r);
}
int main() {
  int n, Q, i, op, k, l, r;
  n = gi();
  Q = gi();
  for (i = 1; i <= n; i++) val[i] = gi();
  build(1, 1, n);
  while (Q--) {
    op = gi();
    l = gi();
    r = gi();
    if (op == 1) {
      k = gi();
      insert(1, l, r, k);
    } else {
      memset(a[0].bas, 0, sizeof(a[0].bas));
      a[0].cnt = a[0].val = 0;
      query(1, l, r);
      printf("%d\n", 1 << a[0].cnt);
    }
  }
}
