#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int x;
  scanf("%d", &x);
  return x;
}
const long double EPS = 1e-12;
const int INF = 1e9 + 10;
const long long LINF = 9000ll * 1000 * 1000 * 1000 * 1000 * 1000 + 100;
const int MN = 2e5 + 10, LG = 32;
int n, q;
int num[LG][4 * MN], seg[LG][4 * MN];
int G[LG];
int Now[LG], cur_num[LG];
int arr[MN];
int lz[4 * MN];
void Add(int a, int t, bool f = false) {
  if (f) {
    for (int i = LG - 2; ~i; --i)
      if (a & (1 << i)) {
        if (~G[i + 1])
          a ^= G[i + 1];
        else {
          G[i + 1] = a;
          break;
        }
      }
    return;
  }
  bool fl = false;
  for (int i = LG - 2; ~i; --i)
    if (a & (1 << i)) {
      if (~Now[i + 1])
        a ^= Now[i + 1], t = (t + cur_num[i + 1]) & 1;
      else {
        Now[i + 1] = a, cur_num[i + 1] = t;
        fl = true;
        break;
      }
    }
  if (!fl) Now[0] = 0, cur_num[0] = max(t, cur_num[0]);
}
void merge(int id1, int id2, int id3) {
  memset(Now, -1, sizeof Now), memset(cur_num, 0, sizeof cur_num);
  for (int i = 0; i < LG; ++i)
    if (~seg[i][id2]) Add(seg[i][id2], num[i][id2]);
  for (int i = 0; i < LG; ++i)
    if (~seg[i][id3]) Add(seg[i][id3], num[i][id3]);
  for (int i = 0; i < LG; ++i) seg[i][id1] = Now[i], num[i][id1] = cur_num[i];
}
void change(int id, int k) {
  memset(Now, -1, sizeof Now), memset(cur_num, 0, sizeof cur_num);
  for (int i = 0; i < LG; ++i)
    if (~seg[i][id]) {
      if (num[i][id]) {
        Add(seg[i][id] ^ k, 1);
      } else
        Add(seg[i][id], 0);
    }
  for (int i = 0; i < LG; ++i) num[i][id] = cur_num[i], seg[i][id] = Now[i];
}
void shift(int id) {
  change(2 * id, lz[id]), change(2 * id + 1, lz[id]);
  lz[2 * id] ^= lz[id], lz[2 * id + 1] ^= lz[id], lz[id] = 0;
}
void build(int id, int b, int e) {
  if (e == b) {
    bool fl = false;
    for (int i = LG - 1; ~i; --i)
      if (arr[b] & (1 << i)) {
        seg[i][id] = arr[b];
        num[i][id] = 1;
        fl = true;
        break;
      }
    if (!fl) seg[0][id] = 0, num[0][id] = 1;
    return;
  }
  int mid = (b + e) >> 1;
  build(2 * id, b, mid), build(2 * id + 1, mid + 1, e);
  merge(id, 2 * id, 2 * id + 1);
}
void upd(int id, int b, int e, int l, int r, int k) {
  if (r < b || e < l) return;
  if (l <= b && e <= r) {
    lz[id] ^= k;
    change(id, k);
    return;
  }
  if (lz[id]) shift(id);
  int mid = (b + e) >> 1;
  upd(2 * id, b, mid, l, r, k), upd(2 * id + 1, mid + 1, e, l, r, k);
  merge(id, 2 * id, 2 * id + 1);
}
void get(int id, int b, int e, int l, int r) {
  if (r < b || e < l) return;
  if (l <= b && e <= r) {
    for (int i = 0; i < LG; ++i)
      if (~seg[i][id]) Add(seg[i][id], num[i][id], 1);
    return;
  }
  if (lz[id]) shift(id);
  int mid = (b + e) >> 1;
  get(2 * id, b, mid, l, r), get(2 * id + 1, mid + 1, e, l, r);
}
void input() {
  memset(seg, -1, sizeof seg);
  cin >> n >> q;
  for (int i = 0; i < n; ++i) cin >> arr[i];
  build(1, 0, n - 1);
  while (q--) {
    int tp;
    cin >> tp;
    if (tp == 1) {
      int l, r, k;
      cin >> l >> r >> k;
      --l, --r;
      upd(1, 0, n - 1, l, r, k);
    } else {
      int c = 0;
      int l, r;
      cin >> l >> r;
      --l, --r;
      memset(G, -1, sizeof G);
      get(1, 0, n - 1, l, r);
      for (int i = 1; i < LG; ++i)
        if (~G[i]) ++c;
      cout << (1 << c) << '\n';
    }
  }
}
int main() {
  ios_base ::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  input();
  return 0;
}
