#include <iostream>
using namespace std;
const int MOD = 1000000007;
const int MAX = 200005;
struct node
{
int a[32], t, x;
node()
{
x = 0;
t = 0;
}
} seg[4 * MAX], tmp;
int a[MAX];
node merge(node l, node r)
{
node ans;
for (int _ = 0; _ < 2; _++)
{
for (int i = 0; i < l.t; i++)
{
int val = l.a[i];
for (int j = 0; j < ans.t; j++)
if (val & ans.a[j] & -ans.a[j])
val ^= ans.a[j];
if (val)
ans.a[ans.t++] = val;
}
swap(l, r);
}
return ans;
}
void shift(int v)
{
seg[2 * v].x ^= seg[v].x;
for (int i = 0; i < seg[2 * v].t; i++)
if (seg[2 * v].a[i] & 1)
seg[2 * v].a[i] ^= seg[v].x;
seg[2 * v + 1].x ^= seg[v].x;
for (int i = 0; i < seg[2 * v + 1].t; i++)
if (seg[2 * v + 1].a[i] & 1)
seg[2 * v + 1].a[i] ^= seg[v].x;
seg[v].x = 0;
}
void build(int v, int s, int e)
{
if (e - s < 2)
{
seg[v].a[seg[v].t++] = a[s];
return;
}
int mid = (s + e) / 2;
build(2 * v, s, mid);
build(2 * v + 1, mid, e);
seg[v] = merge(seg[2 * v], seg[2 * v + 1]);
}
void upd(int l, int r, int val, int v, int s, int e)
{
if (l <= s && e <= r)
{
seg[v].x ^= val;
for (int i = 0; i < seg[v].t; i++)
if (seg[v].a[i] & 1)
seg[v].a[i] ^= val;
return;
}
if (e <= l || r <= s)
return;
shift(v);
int mid = (s + e) / 2;
upd(l, r, val, 2 * v, s, mid);
upd(l, r, val, 2 * v + 1, mid, e);
seg[v] = merge(seg[2 * v], seg[2 * v + 1]);
}
node get(int l, int r, int v, int s, int e)
{
if (l <= s && e <= r)
return seg[v];
if (e <= l || r <= s)
return node();
shift(v);
int mid = (s + e) / 2;
return merge(get(l, r, 2 * v, s, mid), get(l, r, 2 * v + 1, mid, e));
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n, q;
cin >> n >> q;
for (int i = 0; i < n; i++)
{
cin >> a[i];
a[i] = a[i] * 2 + 1;
}
build(1, 0, n);
while (q--)
{
int t;
cin >> t;
if (t == 2)
{
int l, r;
cin >> l >> r;
l--;
node ans = get(l, r, 1, 0, n);
for (int i = 0; i < ans.t; i++)
if (ans.a[i] & 1)
ans.a[i]--;
cout << (1 << merge(ans, tmp).t) << "\n";
}
else
{
int l, r, val;
cin >> l >> r >> val;
l--;
val *= 2;
upd(l, r, val, 1, 0, n);
}
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwpjb25zdCBpbnQgTU9EID0gMTAwMDAwMDAwNzsKY29uc3QgaW50IE1BWCA9IDIwMDAwNTsKc3RydWN0IG5vZGUKewoJaW50IGFbMzJdLCB0LCB4OwoJbm9kZSgpCgl7CgkJeCA9IDA7CgkJdCA9IDA7Cgl9Cn0gc2VnWzQgKiBNQVhdLCB0bXA7CmludCBhW01BWF07Cm5vZGUgbWVyZ2Uobm9kZSBsLCBub2RlIHIpCnsKCW5vZGUgYW5zOwoJZm9yIChpbnQgXyA9IDA7IF8gPCAyOyBfKyspCgl7CgkJZm9yIChpbnQgaSA9IDA7IGkgPCBsLnQ7IGkrKykKCQl7CgkJCWludCB2YWwgPSBsLmFbaV07CgkJCWZvciAoaW50IGogPSAwOyBqIDwgYW5zLnQ7IGorKykKCQkJCWlmICh2YWwgJiBhbnMuYVtqXSAmIC1hbnMuYVtqXSkKCQkJCQl2YWwgXj0gYW5zLmFbal07CgkJCWlmICh2YWwpCgkJCQlhbnMuYVthbnMudCsrXSA9IHZhbDsKCQl9CgkJc3dhcChsLCByKTsKCX0KCXJldHVybiBhbnM7Cn0Kdm9pZCBzaGlmdChpbnQgdikKewoJc2VnWzIgKiB2XS54IF49IHNlZ1t2XS54OwoJZm9yIChpbnQgaSA9IDA7IGkgPCBzZWdbMiAqIHZdLnQ7IGkrKykKCQlpZiAoc2VnWzIgKiB2XS5hW2ldICYgMSkKCQkJc2VnWzIgKiB2XS5hW2ldIF49IHNlZ1t2XS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