#include <bits/stdc++.h>
using namespace std;
long long pwr(long long base, long long p, long long mod = (1000000007LL)) {
  long long ans = 1;
  while (p) {
    if (p & 1) ans = (ans * base) % mod;
    base = (base * base) % mod;
    p /= 2;
  }
  return ans;
}
int n, arr[200005], tree[800005], lazy[800005];
void build(int node, int s, int e) {
  if (s > e) return;
  if (s == e) {
    tree[node] = arr[s];
    return;
  }
  int mid = (s + e) / 2;
  build((2 * (node)), s, mid);
  build((2 * (node) + 1), mid + 1, e);
  tree[node] = tree[(2 * (node))] ^ tree[(2 * (node) + 1)];
}
void update(int node, int s, int e, int lo, int hi, int val) {
  if (s > e) return;
  if (lazy[node] != 0) {
    tree[node] ^= lazy[node];
    if (s != e) {
      lazy[(2 * (node))] ^= lazy[node];
      lazy[(2 * (node) + 1)] ^= lazy[node];
    }
    lazy[node] = 0;
  }
  if (lo > e || s > hi) return;
  if (s >= lo && e <= hi) {
    tree[node] ^= val;
    if (s != e) {
      lazy[(2 * (node))] ^= val;
      lazy[(2 * (node) + 1)] ^= val;
    }
    return;
  }
  int mid = (s + e) / 2;
  update((2 * (node)), s, mid, lo, hi, val);
  update((2 * (node) + 1), mid + 1, e, lo, hi, val);
  tree[node] = tree[(2 * (node))] ^ tree[(2 * (node) + 1)];
}
int query(int node, int s, int e, int pos) {
  if (s > e) return 0;
  if (lazy[node] != 0) {
    tree[node] ^= lazy[node];
    if (s != e) {
      lazy[(2 * (node))] ^= lazy[node];
      lazy[(2 * (node) + 1)] ^= lazy[node];
    }
    lazy[node] = 0;
  }
  if (pos > e || s > pos) return 0;
  if (s == e) return tree[node];
  int mid = (s + e) / 2;
  int a = query((2 * (node)), s, mid, pos);
  int b = query((2 * (node) + 1), mid + 1, e, pos);
  return a ^ b;
}
void insert(vector<int> &v, int val) {
  for (int i = 0; i < (int)v.size(); i++) val = min(val, val ^ v[i]);
  if (val > 0) v.push_back(val);
}
vector<int> tree2[800005];
void build2(int node, int s, int e) {
  if (s > e) return;
  if (s == e) {
    if (arr[s] > 0) tree2[node].push_back(arr[s]);
    return;
  }
  int mid = (s + e) / 2;
  build2((2 * (node)), s, mid);
  build2((2 * (node) + 1), mid + 1, e);
  tree2[node] = tree2[(2 * (node))];
  for (int k = 0; k < (int)tree2[(2 * (node) + 1)].size(); k++)
    insert(tree2[node], tree2[(2 * (node) + 1)][k]);
}
void update2(int node, int s, int e, int pos, int val) {
  if (s > e || pos > e || s > pos) return;
  if (s == e) {
    int last = 0;
    if (!tree2[node].empty()) last = tree2[node][0];
    tree2[node].clear();
    if ((last ^ val) > 0) tree2[node].push_back(last ^ val);
    return;
  }
  int mid = (s + e) / 2;
  update2((2 * (node)), s, mid, pos, val);
  update2((2 * (node) + 1), mid + 1, e, pos, val);
  tree2[node] = tree2[(2 * (node))];
  for (int k = 0; k < (int)tree2[(2 * (node) + 1)].size(); k++)
    insert(tree2[node], tree2[(2 * (node) + 1)][k]);
}
vector<int> query2(int node, int s, int e, int lo, int hi) {
  if (s > e || lo > e || s > hi) return vector<int>(0);
  if (s >= lo && e <= hi) return tree2[node];
  int mid = (s + e) / 2;
  vector<int> a = query2((2 * (node)), s, mid, lo, hi);
  vector<int> b = query2((2 * (node) + 1), mid + 1, e, lo, hi);
  for (int k = 0; k < (int)b.size(); k++) insert(a, b[k]);
  return a;
}
int main() {
  int q;
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
  }
  build(1, 1, n);
  for (int i = n; i >= 2; i--) {
    arr[i] ^= arr[i - 1];
  }
  build2(1, 1, n);
  while (q--) {
    int op;
    scanf("%d", &op);
    if (op == 1) {
      int l, r, val;
      scanf("%d%d%d", &l, &r, &val);
      update(1, 1, n, l, r, val);
      update2(1, 1, n, l, val);
      update2(1, 1, n, r + 1, val);
    } else {
      int l, r;
      scanf("%d%d", &l, &r);
      int firstval = query(1, 1, n, l);
      if (l == r) {
        if (firstval == 0)
          printf("1\n");
        else
          printf("2\n");
      } else {
        vector<int> ans = query2(1, 1, n, l + 1, r);
        insert(ans, firstval);
        printf("%d\n", (1 << (int)ans.size()));
      }
    }
  }
  return 0;
}
