#include <bits/stdc++.h>
const int W = 30, N = 200005;
int n, a[N], b[N], Q, opt, l, r, x, t2[N * 4], tag;
struct line {
  int a[31], siz;
  void clear() {
    memset(a, 0, sizeof(a));
    siz = 0;
  }
  void insert(int x) {
    for (int i = W; i >= 0; i--)
      if (x & (1 << i)) {
        if (!a[i]) {
          a[i] = x;
          siz++;
          break;
        } else
          x ^= a[i];
      }
  }
  friend line operator+(line x, const line y) {
    for (int i = 0; i <= W; i++) x.insert(y.a[i]);
    return x;
  }
} t[N * 4], ans;
void build(int k, int l, int r) {
  if (l == r) {
    t[k].insert(b[l]);
    return;
  }
  int mid = (l + r) >> 1;
  build(k << 1, l, mid), build(k << 1 | 1, mid + 1, r);
  t[k] = t[k << 1] + t[k << 1 | 1];
}
void modify(int k, int l, int r, int x) {
  if (l == r) {
    t[k].clear();
    t[k].insert(b[x]);
    return;
  }
  int mid = (l + r) >> 1;
  if (x <= mid)
    modify(k << 1, l, mid, x);
  else
    modify(k << 1 | 1, mid + 1, r, x);
  t[k] = t[k << 1] + t[k << 1 | 1];
}
void query(int k, int L, int R, int l, int r) {
  if (L == l && R == r) {
    ans = ans + t[k];
    return;
  }
  int mid = (L + R) >> 1;
  if (r <= mid)
    query(k << 1, L, mid, l, r);
  else if (l > mid)
    query(k << 1 | 1, mid + 1, R, l, r);
  else {
    query(k << 1, L, mid, l, mid);
    query(k << 1 | 1, mid + 1, R, mid + 1, r);
  }
}
void modify2(int k, int L, int R, int l, int r, int x) {
  if (L == l && R == r) {
    t2[k] ^= x;
    return;
  }
  int mid = (L + R) >> 1;
  if (r <= mid)
    modify2(k << 1, L, mid, l, r, x);
  else if (l > mid)
    modify2(k << 1 | 1, mid + 1, R, l, r, x);
  else {
    modify2(k << 1, L, mid, l, mid, x);
    modify2(k << 1 | 1, mid + 1, R, mid + 1, r, x);
  }
}
void query(int k, int l, int r, int x) {
  tag ^= t2[k];
  if (l == r) return;
  int mid = (l + r) >> 1;
  if (x <= mid)
    query(k << 1, l, mid, x);
  else
    query(k << 1 | 1, mid + 1, r, x);
}
int main() {
  scanf("%d%d", &n, &Q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) b[i] = a[i] ^ a[i - 1];
  build(1, 1, n);
  while (Q--) {
    scanf("%d", &opt);
    if (opt == 1) {
      scanf("%d%d%d", &l, &r, &x);
      modify2(1, 1, n, l, r, x);
      b[l] ^= x, modify(1, 1, n, l);
      if (r + 1 > n) continue;
      b[r + 1] ^= x, modify(1, 1, n, r + 1);
    } else {
      scanf("%d%d", &l, &r);
      ans.clear();
      tag = 0, query(1, 1, n, r);
      ans.insert(a[r] ^ tag);
      if (l + 1 <= r) query(1, 1, n, l + 1, r);
      printf("%d\n", 1 << ans.siz);
    }
  }
}
