import java.io.*;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;
public class TaskE_opt {
private final InputReader reader;
private final OutputWriter writer;
public TaskE_opt(InputReader reader, OutputWriter writer) {
this.reader = reader;
this.writer = writer;
}
public static void main
(String[] args
) { InputReader reader
= new InputReader
(System.
in); OutputWriter writer
= new OutputWriter
(System.
out); new TaskE_opt(reader, writer).run();
writer.writer.flush();
}
class FixedPointSegmentTree {
int[] T;
int N;
FixedPointSegmentTree(int n) {
N = 1;
while (N < n)
N <<= 1;
T = new int[2 * N];
}
void add(int l, int r, int x) {
l += N;
r += N;
while (r >= l) {
if ((l & 1) == 1)
T[l] ^= x;
if ((r & 1) == 0)
T[r] ^= x;
l = (l + 1) >> 1;
r = (r - 1) >> 1;
}
}
int get(int i) {
for (int l = 0, r = N - 1, v = 1; ; ) {
if (l == r)
return T[v];
T[2 * v] ^= T[v];
T[2 * v + 1] ^= T[v];
T[v] = 0;
if (i <= (l + r) / 2) {
r = (l + r) / 2;
v = 2 * v;
} else {
l = (l + r) / 2 + 1;
v = 2 * v + 1;
}
}
}
}
final int K = 30;
int[] tmp = new int[50 * K];
int tn = 0;
int gauss(int[] C) {
int pt = 0;
for (int i = 0; i < K; i++) {
int ind = -1;
for (int j = pt; j < tn; j++) {
if (((tmp[j] >> i) & 1) == 1)
ind = j;
}
if (ind == -1)
continue;
C[pt] = tmp[ind];
tmp[ind] = tmp[pt];
for (int j = pt + 1; j < tn; j++)
if (((tmp[j] >> i) & 1) == 1)
tmp[j] ^= C[pt];
pt++;
}
return pt;
}
int merge(int[] A, int apt, int[] B, int bpt, int[] C) {
tn = 0;
for (int i = 0; i < apt; i++) {
if (A[i] == 0)
break;
tmp[tn++] = A[i];
}
for (int i = 0; i < bpt; i++) {
if (B[i] == 0)
break;
tmp[tn++] = B[i];
}
return gauss(C);
}
void write(int[] A, int len) {
for (int i = 0; i < len; i++)
tmp[tn++] = A[i];
}
class BasisSegmentTree {
int[][] T;
int[] Tpt;
int N = 1;
BasisSegmentTree(int n) {
while (N < n)
N <<= 1;
T = new int[2 * N][K];
Tpt = new int[2 * N];
}
void init() {
for (int i = N - 1; i > 0; i--)
Tpt[i] = merge(T[2 * i], Tpt[2 * i], T[2 * i + 1], Tpt[2 * i + 1], T[i]);
}
void update(int x, int v) {
if (x < 0 || x >= N)
return;
x += N;
T[x][0] ^= v;
Tpt[x] = (T[x][0] == 0) ? 0 : 1;
while ((x >>= 1) > 0)
Tpt[x] = merge(T[2 * x], Tpt[2 * x], T[2 * x + 1], Tpt[2 * x + 1], T[x]);
}
void get(int l, int r) {
l += N;
r += N;
int tpt = 0;
tn = 0;
while (l <= r) {
if ((l & 1) == 1)
write(T[l], Tpt[l]);
if ((r & 1) == 0)
write(T[r], Tpt[r]);
l = (l + 1) >> 1;
r = (r - 1) >> 1;
}
}
}
public void run() {
int n = reader.nextInt();
int q = reader.nextInt();
FixedPointSegmentTree T = new FixedPointSegmentTree(n);
BasisSegmentTree B = new BasisSegmentTree(n - 1);
int lst = 0;
for (int i = 0; i < n; i++) {
int t = reader.nextInt();
T.T[T.N + i] = t;
if (i > 0) {
B.T[B.N + i - 1][0] = t ^ lst;
B.Tpt[B.N + i - 1] = ((t ^ lst) > 0) ? 1 : 0;
}
lst = t;
}
B.init();
int[] to = new int[K];
for (int i = 0; i < q; i++) {
int t = reader.nextInt();
if (t == 1) {
int l = reader.nextInt() - 1;
int r = reader.nextInt() - 1;
int x = reader.nextInt();
B.update(l - 1, x);
B.update(r, x);
T.add(l, r, x);
} else {
int l = reader.nextInt() - 1;
int r = reader.nextInt() - 1;
B.get(l, r - 1);
tmp[tn++] = T.get(l);
int res = gauss(to);
writer.printf("%d\n", 1 << res);
}
}
}
static class InputReader {
tokenizer = null;
}
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
}
}
return tokenizer.nextToken();
}
public int nextInt() {
}
public double nextDouble() {
return Double.
parseDouble(next
()); }
public long nextLong() {
return Long.
parseLong(next
()); }
}
static class OutputWriter {
}
}
}
}
aW1wb3J0IGphdmEuaW8uKjsKaW1wb3J0IGphdmEudXRpbC5BcnJheXM7CmltcG9ydCBqYXZhLnV0aWwuTG9jYWxlOwppbXBvcnQgamF2YS51dGlsLlN0cmluZ1Rva2VuaXplcjsKCnB1YmxpYyBjbGFzcyBUYXNrRV9vcHQgewogICAgcHJpdmF0ZSBmaW5hbCBJbnB1dFJlYWRlciByZWFkZXI7CiAgICBwcml2YXRlIGZpbmFsIE91dHB1dFdyaXRlciB3cml0ZXI7CgogICAgcHVibGljIFRhc2tFX29wdChJbnB1dFJlYWRlciByZWFkZXIsIE91dHB1dFdyaXRlciB3cml0ZXIpIHsKICAgICAgICB0aGlzLnJlYWRlciA9IHJlYWRlcjsKICAgICAgICB0aGlzLndyaXRlciA9IHdyaXRlcjsKICAgIH0KCiAgICBwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmdbXSBhcmdzKSB7CiAgICAgICAgSW5wdXRSZWFkZXIgcmVhZGVyID0gbmV3IElucHV0UmVhZGVyKFN5c3RlbS5pbik7CiAgICAgICAgT3V0cHV0V3JpdGVyIHdyaXRlciA9IG5ldyBPdXRwdXRXcml0ZXIoU3lzdGVtLm91dCk7CiAgICAgICAgbmV3IFRhc2tFX29wdChyZWFkZXIsIHdyaXRlcikucnVuKCk7CiAgICAgICAgd3JpdGVyLndyaXRlci5mbHVzaCgpOwogICAgfQoKICAgIGNsYXNzIEZpeGVkUG9pbnRTZWdtZW50VHJlZSB7CiAgICAgICAgaW50W10gVDsKICAgICAgICBpbnQgTjsKICAgICAgICBGaXhlZFBvaW50U2VnbWVudFRyZWUoaW50IG4pIHsKICAgICAgICAgICAgTiA9IDE7CiAgICAgICAgICAgIHdoaWxlIChOIDwgbikKICAgICAgICAgICAgICAgIE4gPDw9IDE7CiAgICAgICAgICAgIFQgPSBuZXcgaW50WzIgKiBOXTsKICAgICAgICB9CiAgICAgICAgdm9pZCBhZGQoaW50IGwsIGludCByLCBpbnQgeCkgewogICAgICAgICAgICBsICs9IE47CiAgICAgICAgICAgIHIgKz0gTjsKICAgICAgICAgICAgd2hpbGUgKHIgPj0gbCkgewogICAgICAgICAgICAgICAgaWYgKChsICYgMSkgPT0gMSkKICAgICAgICAgICAgICAgICAgICBUW2xdIF49IHg7CiAgICAgICAgICAgICAgICBpZiAoKHIgJiAxKSA9PSAwKQogICAgICAgICAgICAgICAgICAgIFRbcl0gXj0geDsKICAgICAgICAgICAgICAgIGwgPSAobCArIDEpID4+IDE7CiAgICAgICAgICAgICAgICByID0gKHIgLSAxKSA+PiAxOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGludCBnZXQoaW50IGkpIHsKICAgICAgICAgICAgZm9yIChpbnQgbCA9IDAsIHIgPSBOIC0gMSwgdiA9IDE7IDsgKSB7CiAgICAgICAgICAgICAgICBpZiAobCA9PSByKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBUW3ZdOwogICAgICAgICAgICAgICAgVFsyICogdl0gXj0gVFt2XTsKICAgICAgICAgICAgICAgIFRbMiAqIHYgKyAxXSBePSBUW3ZdOwogICAgICAgICAgICAgICAgVFt2XSA9IDA7CiAgICAgICAgICAgICAgICBpZiAoaSA8PSAobCArIHIpIC8gMikgewogICAgICAgICAgICAgICAgICAgIHIgPSAobCArIHIpIC8gMjsKICAgICAgICAgICAgICAgICAgICB2ID0gMiAqIHY7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIGwgPSAobCArIHIpIC8gMiArIDE7CiAgICAgICAgICAgICAgICAgICAgdiA9IDIgKiB2ICsgMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KCiAgICBmaW5hbCBpbnQgSyA9IDMwOwogICAgaW50W10gdG1wID0gbmV3IGludFs1MCAqIEtdOwogICAgaW50IHRuID0gMDsKICAgIGludCBnYXVzcyhpbnRbXSBDKSB7CiAgICAgICAgaW50IHB0ID0gMDsKICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IEs7IGkrKykgewogICAgICAgICAgICBpbnQgaW5kID0gLTE7CiAgICAgICAgICAgIGZvciAoaW50IGogPSBwdDsgaiA8IHRuOyBqKyspIHsKICAgICAgICAgICAgICAgIGlmICgoKHRtcFtqXSA+PiBpKSAmIDEpID09IDEpCiAgICAgICAgICAgICAgICAgICAgaW5kID0gajsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoaW5kID09IC0xKQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIENbcHRdID0gdG1wW2luZF07CiAgICAgICAgICAgIHRtcFtpbmRdID0gdG1wW3B0XTsKICAgICAgICAgICAgZm9yIChpbnQgaiA9IHB0ICsgMTsgaiA8IHRuOyBqKyspCiAgICAgICAgICAgICAgICBpZiAoKCh0bXBbal0gPj4gaSkgJiAxKSA9PSAxKQogICAgICAgICAgICAgICAgICAgIHRtcFtqXSBePSBDW3B0XTsKICAgICAgICAgICAgcHQrKzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHB0OwogICAgfQoKICAgIGludCBtZXJnZShpbnRbXSBBLCBpbnQgYXB0LCBpbnRbXSBCLCBpbnQgYnB0LCBpbnRbXSBDKSB7CiAgICAgICAgdG4gPSAwOwogICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgYXB0OyBpKyspIHsKICAgICAgICAgICAgaWYgKEFbaV0gPT0gMCkKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB0bXBbdG4rK10gPSBBW2ldOwogICAgICAgIH0KICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGJwdDsgaSsrKSB7CiAgICAgICAgICAgIGlmIChCW2ldID09IDApCiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgdG1wW3RuKytdID0gQltpXTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGdhdXNzKEMpOwogICAgfQoKICAgIHZvaWQgd3JpdGUoaW50W10gQSwgaW50IGxlbikgewogICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuOyBpKyspCiAgICAgICAgICAgIHRtcFt0bisrXSA9IEFbaV07CiAgICB9CgogICAgY2xhc3MgQmFzaXNTZWdtZW50VHJlZSB7CiAgICAgICAgaW50W11bXSBUOwogICAgICAgIGludFtdIFRwdDsKICAgICAgICBpbnQgTiA9IDE7CgogICAgICAgIEJhc2lzU2VnbWVudFRyZWUoaW50IG4pIHsKICAgICAgICAgICAgd2hpbGUgKE4gPCBuKQogICAgICAgICAgICAgICAgTiA8PD0gMTsKICAgICAgICAgICAgVCA9IG5ldyBpbnRbMiAqIE5dW0tdOwogICAgICAgICAgICBUcHQgPSBuZXcgaW50WzIgKiBOXTsKICAgICAgICB9CgogICAgICAgIHZvaWQgaW5pdCgpIHsKICAgICAgICAgICAgZm9yIChpbnQgaSA9IE4gLSAxOyBpID4gMDsgaS0tKQogICAgICAgICAgICAgICAgVHB0W2ldID0gbWVyZ2UoVFsyICogaV0sIFRwdFsyICogaV0sIFRbMiAqIGkgKyAxXSwgVHB0WzIgKiBpICsgMV0sIFRbaV0pOwogICAgICAgIH0KCiAgICAgICAgdm9pZCB1cGRhdGUoaW50IHgsIGludCB2KSB7CiAgICAgICAgICAgIGlmICh4IDwgMCB8fCB4ID49IE4pCiAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgIHggKz0gTjsKICAgICAgICAgICAgVFt4XVswXSBePSB2OwogICAgICAgICAgICBUcHRbeF0gPSAoVFt4XVswXSA9PSAwKSA/IDAgOiAxOwogICAgICAgICAgICB3aGlsZSAoKHggPj49IDEpID4gMCkKICAgICAgICAgICAgICAgIFRwdFt4XSA9IG1lcmdlKFRbMiAqIHhdLCBUcHRbMiAqIHhdLCBUWzIgKiB4ICsgMV0sIFRwdFsyICogeCArIDFdLCBUW3hdKTsKICAgICAgICB9CiAgICAgICAgdm9pZCBnZXQoaW50IGwsIGludCByKSB7CiAgICAgICAgICAgIGwgKz0gTjsKICAgICAgICAgICAgciArPSBOOwogICAgICAgICAgICBpbnQgdHB0ID0gMDsKICAgICAgICAgICAgdG4gPSAwOwogICAgICAgICAgICB3aGlsZSAobCA8PSByKSB7CiAgICAgICAgICAgICAgICBpZiAoKGwgJiAxKSA9PSAxKQogICAgICAgICAgICAgICAgICAgIHdyaXRlKFRbbF0sIFRwdFtsXSk7CiAgICAgICAgICAgICAgICBpZiAoKHIgJiAxKSA9PSAwKQogICAgICAgICAgICAgICAgICAgIHdyaXRlKFRbcl0sIFRwdFtyXSk7CiAgICAgICAgICAgICAgICBsID0gKGwgKyAxKSA+PiAxOwogICAgICAgICAgICAgICAgciA9IChyIC0gMSkgPj4gMTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KCiAgICBwdWJsaWMgdm9pZCBydW4oKSB7CiAgICAgICAgaW50IG4gPSByZWFkZXIubmV4dEludCgpOwogICAgICAgIGludCBxID0gcmVhZGVyLm5leHRJbnQoKTsKCiAgICAgICAgRml4ZWRQb2ludFNlZ21lbnRUcmVlIFQgPSBuZXcgRml4ZWRQb2ludFNlZ21lbnRUcmVlKG4pOwogICAgICAgIEJhc2lzU2VnbWVudFRyZWUgQiA9IG5ldyBCYXNpc1NlZ21lbnRUcmVlKG4gLSAxKTsKCiAgICAgICAgaW50IGxzdCA9IDA7CiAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspIHsKICAgICAgICAgICAgaW50IHQgPSByZWFkZXIubmV4dEludCgpOwogICAgICAgICAgICBULlRbVC5OICsgaV0gPSB0OwogICAgICAgICAgICBpZiAoaSA+IDApIHsKICAgICAgICAgICAgICAgIEIuVFtCLk4gKyBpIC0gMV1bMF0gPSB0IF4gbHN0OwogICAgICAgICAgICAgICAgQi5UcHRbQi5OICsgaSAtIDFdID0gKCh0IF4gbHN0KSA+IDApID8gMSA6IDA7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbHN0ID0gdDsKICAgICAgICB9CiAgICAgICAgQi5pbml0KCk7CiAgICAgICAgaW50W10gdG8gPSBuZXcgaW50W0tdOwogICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgcTsgaSsrKSB7CiAgICAgICAgICAgIGludCB0ID0gcmVhZGVyLm5leHRJbnQoKTsKICAgICAgICAgICAgaWYgKHQgPT0gMSkgewogICAgICAgICAgICAgICAgaW50IGwgPSByZWFkZXIubmV4dEludCgpIC0gMTsKICAgICAgICAgICAgICAgIGludCByID0gcmVhZGVyLm5leHRJbnQoKSAtIDE7CiAgICAgICAgICAgICAgICBpbnQgeCA9IHJlYWRlci5uZXh0SW50KCk7CiAgICAgICAgICAgICAgICBCLnVwZGF0ZShsIC0gMSwgeCk7CiAgICAgICAgICAgICAgICBCLnVwZGF0ZShyLCB4KTsKICAgICAgICAgICAgICAgIFQuYWRkKGwsIHIsIHgpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgaW50IGwgPSByZWFkZXIubmV4dEludCgpIC0gMTsKICAgICAgICAgICAgICAgIGludCByID0gcmVhZGVyLm5leHRJbnQoKSAtIDE7CiAgICAgICAgICAgICAgICBCLmdldChsLCByIC0gMSk7CiAgICAgICAgICAgICAgICB0bXBbdG4rK10gPSBULmdldChsKTsKICAgICAgICAgICAgICAgIGludCByZXMgPSBnYXVzcyh0byk7CiAgICAgICAgICAgICAgICB3cml0ZXIucHJpbnRmKCIlZFxuIiwgMSA8PCByZXMpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQogICAgc3RhdGljIGNsYXNzIElucHV0UmVhZGVyIHsKICAgICAgICBwdWJsaWMgQnVmZmVyZWRSZWFkZXIgcmVhZGVyOwogICAgICAgIHB1YmxpYyBTdHJpbmdUb2tlbml6ZXIgdG9rZW5pemVyOwoKICAgICAgICBwdWJsaWMgSW5wdXRSZWFkZXIoSW5wdXRTdHJlYW0gc3RyZWFtKSB7CiAgICAgICAgICAgIHJlYWRlciA9IG5ldyBCdWZmZXJlZFJlYWRlcihuZXcgSW5wdXRTdHJlYW1SZWFkZXIoc3RyZWFtKSwgMzI3NjgpOwogICAgICAgICAgICB0b2tlbml6ZXIgPSBudWxsOwogICAgICAgIH0KCiAgICAgICAgcHVibGljIFN0cmluZyBuZXh0KCkgewogICAgICAgICAgICB3aGlsZSAodG9rZW5pemVyID09IG51bGwgfHwgIXRva2VuaXplci5oYXNNb3JlVG9rZW5zKCkpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgdG9rZW5pemVyID0gbmV3IFN0cmluZ1Rva2VuaXplcihyZWFkZXIucmVhZExpbmUoKSk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFJ1bnRpbWVFeGNlcHRpb24oZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHRva2VuaXplci5uZXh0VG9rZW4oKTsKICAgICAgICB9CgogICAgICAgIHB1YmxpYyBpbnQgbmV4dEludCgpIHsKICAgICAgICAgICAgcmV0dXJuIEludGVnZXIucGFyc2VJbnQobmV4dCgpKTsKICAgICAgICB9CgogICAgICAgIHB1YmxpYyBkb3VibGUgbmV4dERvdWJsZSgpIHsKICAgICAgICAgICAgcmV0dXJuIERvdWJsZS5wYXJzZURvdWJsZShuZXh0KCkpOwogICAgICAgIH0KCiAgICAgICAgcHVibGljIGxvbmcgbmV4dExvbmcoKSB7CiAgICAgICAgICAgIHJldHVybiBMb25nLnBhcnNlTG9uZyhuZXh0KCkpOwogICAgICAgIH0KICAgIH0KCiAgICBzdGF0aWMgY2xhc3MgT3V0cHV0V3JpdGVyIHsKICAgICAgICBwdWJsaWMgUHJpbnRXcml0ZXIgd3JpdGVyOwoKICAgICAgICBPdXRwdXRXcml0ZXIoT3V0cHV0U3RyZWFtIHN0cmVhbSkgewogICAgICAgICAgICB3cml0ZXIgPSBuZXcgUHJpbnRXcml0ZXIoc3RyZWFtKTsKICAgICAgICB9CgogICAgICAgIHB1YmxpYyB2b2lkIHByaW50ZihTdHJpbmcgZm9ybWF0LCBPYmplY3QuLi4gYXJncykgewogICAgICAgICAgICB3cml0ZXIucHJpbnQoU3RyaW5nLmZvcm1hdChMb2NhbGUuRU5HTElTSCwgZm9ybWF0LCBhcmdzKSk7CiAgICAgICAgfQogICAgfQp9Cgo=