#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define Foreach(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i))
#define rof(i,a,b) for(int (i)=(a);(i) > (b); --(i))
#define rep(i, c) for(auto &(i) : (c))
#define x first
#define y second
#define pb push_back
#define PB pop_back()
#define iOS ios_base::sync_with_stdio(false)
#define sqr(a) (((a) * (a)))
#define all(a) a.begin() , a.end()
#define error(x) cerr << #x << " = " << (x) <<endl
#define Error(a,b) cerr<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define errop(a) cerr<<#a<<" = ( "<<((a).x)<<" , "<<((a).y)<<" )\n";
#define coud(a,b) cout<<fixed << setprecision((b)) << (a)
#define L(x) ((x)<<1)
#define R(x) (((x)<<1)+1)
#define umap unordered_map
#define double long double
typedef long long ll;
typedef pair<int,int>pii;
typedef vector<int> vi;
typedef complex<double> point;
template <typename T> using os = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T> inline void smax(T &x,T y){ x = max((x), (y));}
template <class T> inline void smin(T &x,T y){ x = min((x), (y));}
const int maxn = 2e5 + 10;
inline int sbit(const int &x){return x & -x;}
struct basis{
int t = 0, a[32] = {};
inline void pb(int x){
For(i,0,t)
if(x & sbit(a[i]))
x ^= a[i];
if(!x) return ;
For(i,0,t)
if(sbit(x) & a[i])
a[i] ^= x;
a[t ++] = x;
}
inline void perform(int k){
For(i,0,t)
if(a[i] & 1)
a[i] ^= k;
}
inline basis operator + (basis b){
if(!t) return b;
if(!b.t) return *this;
basis ans;
For(i,0,t)
ans.pb(a[i]);
For(i,0,b.t)
ans.pb(b.a[i]);
return ans;
}
}v[maxn * 4], emp;
int lz[maxn * 4], a[maxn], n, q, p2[35];
inline void upd(int id, int k){
if(!k) return ;
lz[id] ^= k;
v[id].perform(k);
}
inline void shift(int id){
upd(L(id), lz[id]);
upd(R(id), lz[id]);
lz[id] = 0;
}
inline void build(int id = 1, int l = 0, int r = n){
if(r - l < 2){
v[id].pb(a[l]);
return ;
}
int mid = (l + r)/2;
build(L(id), l, mid);
build(R(id), mid, r);
v[id] = v[L(id)] + v[R(id)];
}
inline void upd(int x, int y, int k, int id = 1, int l = 0, int r = n){
if(x >= r or l >= y) return ;
if(x <= l && r <= y){
upd(id, k);
return ;
}
int mid = (l + r)/2;
shift(id);
upd(x, y, k, L(id), l, mid);
upd(x, y, k, R(id), mid, r);
v[id] = v[L(id)] + v[R(id)];
}
inline basis ask(int x, int y, int id = 1, int l = 0, int r = n){
if(x >= r or l >= y) return emp;
if(x <= l && r <= y) return v[id];
int mid = (l + r)/2;
shift(id);
return ask(x, y, L(id), l, mid) + ask(x, y, R(id), mid, r);
}
int main(){
scanf("%d %d", &n, &q);
For(i,0,n){
scanf("%d", a + i);
a[i] = 2*a[i] + 1;
}
build();
For(i,0,35) p2[i] = (1 << i);
while(q --){
int t, l, r, k;
scanf("%d %d %d", &t, &l, &r);
-- l;
if(t == 1){
scanf("%d", &k);
upd(l, r, k << 1);
}
else{
basis ans, b = ask(l, r);
For(i,0,b.t)
ans.pb(b.a[i] >> 1);
printf("%d\n", p2[ans.t]);
}
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNpbmNsdWRlIDxleHQvcGJfZHMvYXNzb2NfY29udGFpbmVyLmhwcD4KI2luY2x1ZGUgPGV4dC9wYl9kcy90cmVlX3BvbGljeS5ocHA+CnVzaW5nIG5hbWVzcGFjZSBfX2dudV9wYmRzOwp1c2luZyBuYW1lc3BhY2Ugc3RkOwojZGVmaW5lIEZvcmVhY2goaSwgYykgZm9yKF9fdHlwZW9mKChjKS5iZWdpbigpKSBpID0gKGMpLmJlZ2luKCk7IGkgIT0gKGMpLmVuZCgpOyArK2kpCiNkZWZpbmUgRm9yKGksYSxiKSBmb3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