#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
int f[N << 2], c[N << 2][35], ans[35], w[N], p[N << 2], n;
inline void insert(int *a, int x) {
  for (int i = 29; ~i; --i)
    if ((x >> i) & 1) {
      if (!a[i])
        return a[i] = x, void();
      else
        x ^= a[i];
    }
  return;
}
inline void merge(int *a, int *b) {
  for (int i = 0; i < 30; ++i)
    if (b[i]) {
      int x = b[i];
      for (int j = 29; ~j; --j)
        if ((x >> j) & 1) {
          if (!a[j]) {
            a[j] = x;
            break;
          } else
            x ^= a[j];
        }
    }
  return;
}
inline void up(int k) {
  for (int i = 0; i < 30; ++i) c[k][i] = 0;
  merge(c[k], c[k << 1]), merge(c[k], c[k << 1 | 1]);
  p[k] = p[k << 1] ^ p[k << 1 | 1];
}
void XOR(int k, int l, int r, int x, int t) {
  if (x > n) return;
  if (l == r) {
    for (int j = 0; j < 30; ++j) c[k][j] = 0;
    insert(c[k], w[l] ^= t);
    p[k] = w[l];
    return;
  }
  int mid = l + r >> 1;
  if (x <= mid)
    XOR(k << 1, l, mid, x, t);
  else
    XOR(k << 1 | 1, mid + 1, r, x, t);
  up(k);
}
void query(int k, int l, int r, int gl, int gr) {
  if (l >= gl && r <= gr) {
    merge(ans, c[k]);
    return;
  }
  int mid = l + r >> 1;
  if (gl <= mid) query(k << 1, l, mid, gl, gr);
  if (gr > mid) query(k << 1 | 1, mid + 1, r, gl, gr);
}
int query(int k, int l, int r, int x) {
  if (r <= x) return p[k];
  int mid = l + r >> 1;
  if (x <= mid)
    return query(k << 1, l, mid, x);
  else
    return p[k << 1] ^ query(k << 1 | 1, mid + 1, r, x);
}
void build(int k, int l, int r) {
  if (l == r) {
    insert(c[k], w[l]);
    p[k] = w[l];
    return;
  }
  int mid = l + r >> 1;
  build(k << 1, l, mid);
  build(k << 1 | 1, mid + 1, r);
  up(k);
}
int main() {
  int m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) scanf("%d", &w[i]);
  for (int i = n; i; --i) w[i] ^= w[i - 1];
  build(1, 1, n);
  while (m--) {
    int opt, l, r, k;
    scanf("%d%d%d", &opt, &l, &r);
    if (opt == 1)
      scanf("%d", &k), XOR(1, 1, n, l, k), XOR(1, 1, n, r + 1, k);
    else {
      for (int i = 0; i < 30; ++i) ans[i] = 0;
      query(1, 1, n, l + 1, r);
      int cnt = 0;
      insert(ans, query(1, 1, n, l));
      for (int i = 0; i < 30; ++i)
        if (ans[i]) ++cnt;
      printf("%d\n", 1 << cnt);
    }
  }
}
