#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
int n, q, a[N];
struct node {
  int base[32], v, lazy;
  void clear(void) {
    memset(base, 0, sizeof base);
    v = lazy = 0;
  }
  void add(int x) {
    for (int i = 31; i >= 0; --i) {
      if ((x >> i) & 1) {
        if (base[i])
          x ^= base[i];
        else {
          base[i] = x;
          break;
        }
      }
    }
  }
  node operator+(node& rh) {
    node ans;
    ans.clear();
    for (int i = 0; i <= 31; ++i) {
      ans.add(base[i]);
      ans.add(rh.base[i]);
    }
    ans.add(v ^ rh.v);
    ans.v = rh.v;
    return ans;
  }
  int count(void) {
    int cnt = 0;
    for (int i = 0; i <= 31; ++i) {
      cnt += base[i] > 0;
    }
    return cnt;
  }
} T[N << 2], ans;
void build(int l, int r, int rt) {
  if (l == r) {
    T[rt].clear();
    T[rt].v = a[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, rt << 1);
  build(mid + 1, r, rt << 1 | 1);
  T[rt] = T[rt << 1] + T[rt << 1 | 1];
}
void pushdown(int rt) {
  if (T[rt].lazy) {
    T[rt << 1].lazy ^= T[rt].lazy;
    T[rt << 1 | 1].lazy ^= T[rt].lazy;
    T[rt << 1].v ^= T[rt].lazy;
    T[rt << 1 | 1].v ^= T[rt].lazy;
    T[rt].lazy = 0;
  }
}
void update(int L, int R, int k, int l, int r, int rt) {
  if (L <= l && r <= R) {
    T[rt].lazy ^= k;
    T[rt].v ^= k;
    return;
  }
  pushdown(rt);
  int mid = (l + r) >> 1;
  if (L <= mid) update(L, R, k, l, mid, rt << 1);
  if (R > mid) update(L, R, k, mid + 1, r, rt << 1 | 1);
  T[rt] = T[rt << 1] + T[rt << 1 | 1];
}
void query(int L, int R, int l, int r, int rt) {
  if (L <= l && r <= R) {
    ans = ans + T[rt];
    return;
  }
  pushdown(rt);
  int mid = (l + r) >> 1;
  if (L <= mid) query(L, R, l, mid, rt << 1);
  if (R > mid) query(L, R, mid + 1, r, rt << 1 | 1);
  T[rt] = T[rt << 1] + T[rt << 1 | 1];
}
int main(void) {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  build(1, n, 1);
  while (q--) {
    int op, l, r, k;
    scanf("%d%d%d", &op, &l, &r);
    if (op == 1) {
      scanf("%d", &k);
      update(l, r, k, 1, n, 1);
    } else {
      ans.clear();
      query(l, r, 1, n, 1);
      printf("%d\n", 1 << ans.count());
    }
  }
  return 0;
}
