#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
constexpr long long mod = 1000000007;
const long long INF = mod * mod;
const long double eps = 1e-12;
const long double pi = acosl(-1.0);
long long mod_pow(long long x, long long n, long long m = mod) {
  if (n < 0) {
    long long res = mod_pow(x, -n, m);
    return mod_pow(res, m - 2, m);
  }
  if (abs(x) >= m) x %= m;
  if (x < 0) x += m;
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % m;
    x = x * x % m;
    n >>= 1;
  }
  return res;
}
struct modint {
  long long n;
  modint() : n(0) { ; }
  modint(long long m) : n(m) {
    if (n >= mod)
      n %= mod;
    else if (n < 0)
      n = (n % mod + mod) % mod;
  }
  operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint& a, modint b) {
  a.n += b.n;
  if (a.n >= mod) a.n -= mod;
  return a;
}
modint operator-=(modint& a, modint b) {
  a.n -= b.n;
  if (a.n < 0) a.n += mod;
  return a;
}
modint operator*=(modint& a, modint b) {
  a.n = ((long long)a.n * b.n) % mod;
  return a;
}
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, long long n) {
  if (n == 0) return modint(1);
  modint res = (a * a) ^ (n / 2);
  if (n % 2) res = res * a;
  return res;
}
long long inv(long long a, long long p) {
  return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }
modint operator/=(modint& a, modint b) {
  a = a / b;
  return a;
}
const int max_n = 1 << 2;
modint fact[max_n], factinv[max_n];
void init_f() {
  fact[0] = modint(1);
  for (int i = 0; i < max_n - 1; i++) {
    fact[i + 1] = fact[i] * modint(i + 1);
  }
  factinv[max_n - 1] = modint(1) / fact[max_n - 1];
  for (int i = max_n - 2; i >= 0; i--) {
    factinv[i] = factinv[i + 1] * modint(i + 1);
  }
}
modint comb(int a, int b) {
  if (a < 0 || b < 0 || a < b) return 0;
  return fact[a] * factinv[b] * factinv[a - b];
}
modint combP(int a, int b) {
  if (a < 0 || b < 0 || a < b) return 0;
  return fact[a] * factinv[a - b];
}
template <typename T, typename U>
struct SegT {
 private:
  int n;
  vector<T> node;
  vector<U> lazy;
  T et;
  U eu;
  function<T(T, T)> f;
  function<T(T, U, int, int)> g;
  function<U(U, U)> h;

 public:
  SegT(vector<T> ori, T _et, U _eu, function<T(T, T)> _f,
       function<T(T, U, int, int)> _g, function<U(U, U)> _h) {
    int sz = ori.size();
    et = _et, eu = _eu;
    f = _f, g = _g, h = _h;
    n = 1;
    while (n < sz) n <<= 1;
    node.resize(2 * n - 1, et);
    lazy.resize(2 * n - 1, eu);
    for (int i = 0; i < sz; i++) {
      node[i + n - 1] = ori[i];
    }
    for (int i = n - 1 - 1; i >= 0; i--) {
      node[i] = f(node[2 * i + 1], node[2 * i + 2]);
    }
  }
  void eval(int k, int l, int r) {
    node[k] = g(node[k], lazy[k], l, r);
    if (r - l > 1) {
      lazy[2 * k + 1] = h(lazy[k], lazy[2 * k + 1]);
      lazy[2 * k + 2] = h(lazy[k], lazy[2 * k + 2]);
    }
    lazy[k] = eu;
  }
  void add(U x, int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    eval(k, l, r);
    if (r <= a || b <= l) return;
    if (a <= l && r <= b) {
      lazy[k] = h(x, lazy[k]);
      eval(k, l, r);
    } else {
      add(x, a, b, k * 2 + 1, l, (l + r) / 2);
      add(x, a, b, k * 2 + 2, (l + r) / 2, r);
      node[k] = f(node[k * 2 + 1], node[k * 2 + 2]);
    }
  }
  T query(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    eval(k, l, r);
    if (r <= a || b <= l) return et;
    if (a <= l && r <= b)
      return node[k];
    else {
      T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
      T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
      return f(vl, vr);
    }
  }
  void update(int loc, T x) {
    int k = 0, l = 0, r = n;
    stack<pair<int, int> > st;
    while (k < n - 1) {
      eval(k, l, r);
      st.push({l, r});
      if (loc < (l + r) / 2) {
        k = 2 * k + 1;
        r = (l + r) / 2;
      } else {
        k = 2 * k + 2;
        l = (l + r) / 2;
      }
    }
    eval(k, l, r);
    st.push({l, r});
    node[k] = x;
    while (k > 0) {
      k = (k - 1) / 2;
      st.pop();
      l = st.top().first, r = st.top().second;
      eval(2 * k + 1, l, (l + r) / 2);
      eval(2 * k + 2, (l + r) / 2, r);
      node[k] = f(node[2 * k + 1], node[2 * k + 2]);
    }
  }
};
using bs = vector<int>;
void add(bs& b, int x) {
  int cur = 30;
  for (int i = 0; i < b.size(); i++) {
    while ((b[i] & (1 << cur)) == 0) cur--;
    if (x >= (1ll << cur + 1)) {
      b.insert(b.begin() + i, x);
      return;
    }
    if (x >= (1 << cur)) x ^= b[i];
  }
  if (x > 0) b.push_back(x);
}
void solve() {
  int n, q;
  cin >> n >> q;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<bs> v(n);
  for (int i = 0; i < n; i++) {
    a[i] ^= (1 << 30);
    add(v[i], a[i]);
  }
  auto f = [&](bs a, bs b) -> bs {
    for (int x : b) add(a, x);
    return a;
  };
  auto g = [&](bs a, int x, int l, int r) -> bs {
    bs res;
    for (int val : a) {
      if (val & (1 << 30))
        add(res, val ^ x);
      else
        add(res, val);
    }
    return res;
  };
  auto h = [&](int a, int b) -> int { return a ^ b; };
  bs init_c;
  SegT<bs, int> st(v, (bs)init_c, 0, f, g, h);
  for (int i = 0; i < q; i++) {
    int t;
    cin >> t;
    if (t == 1) {
      int l, r, x;
      cin >> l >> r >> x;
      l--;
      r--;
      st.add(x, l, r + 1);
    } else {
      int l, r;
      cin >> l >> r;
      l--;
      r--;
      bs b = st.query(l, r + 1);
      bs nex;
      for (int x : b) add(nex, x % (1 << 30));
      int ans = 1;
      for (int i = 0; i < nex.size(); i++) ans *= 2;
      cout << ans << "\n";
    }
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}

### Prompt

Construct a CPP code solution to the problem outlined:

Duff is the queen of her country, Andarz Gu. She's a competitive programming fan. That's why, when he saw her minister, Malek, free, she gave her a sequence consisting of n non-negative integers, a1, a2, ..., an and asked him to perform q queries for her on this sequence.

<image>

There are two types of queries:

  1. given numbers l, r and k, Malek should perform <image> for each l ≤ i ≤ r (<image>, bitwise exclusive OR of numbers a and b). 
  2. given numbers l and r Malek should tell her the score of sequence al, al + 1, ... , ar. 



Score of a sequence b1, ..., bk is the number of its different Kheshtaks. A non-negative integer w is a Kheshtak of this sequence if and only if there exists a subsequence of b, let's denote it as bi1, bi2, ... , bix (possibly empty) such that <image> (1 ≤ i1 < i2 < ... < ix ≤ k). If this subsequence is empty, then w = 0.

Unlike Duff, Malek is not a programmer. That's why he asked for your help. Please help him perform these queries.

Input

The first line of input contains two integers, n and q (1 ≤ n ≤ 2 × 105 and 1 ≤ q ≤ 4 × 104).

The second line of input contains n integers, a1, a2, ..., an separated by spaces (0 ≤ ai ≤ 109 for each 1 ≤ i ≤ n).

The next q lines contain the queries. Each line starts with an integer t (1 ≤ t ≤ 2), type of the corresponding query. If t = 1, then there are three more integers in that line, l, r and k. Otherwise there are two more integers, l and r. (1 ≤ l ≤ r ≤ n and 0 ≤ k ≤ 109)

Output

Print the answer of each query of the second type in one line.

Examples

Input

5 5
1 2 3 4 2
2 1 5
1 2 2 8
2 1 5
1 1 3 10
2 2 2


Output

8
16
1

Note

In the first query, we want all Kheshtaks of sequence 1, 2, 3, 4, 2 which are: 0, 1, 2, 3, 4, 5, 6, 7.

In the third query, we want all Khestaks of sequence 1, 10, 3, 4, 2 which are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15.

In the fifth query, we want all Kheshtaks of sequence 0 which is 0.

### Response

```cpp
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
constexpr long long mod = 1000000007;
const long long INF = mod * mod;
const long double eps = 1e-12;
const long double pi = acosl(-1.0);
long long mod_pow(long long x, long long n, long long m = mod) {
  if (n < 0) {
    long long res = mod_pow(x, -n, m);
    return mod_pow(res, m - 2, m);
  }
  if (abs(x) >= m) x %= m;
  if (x < 0) x += m;
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % m;
    x = x * x % m;
    n >>= 1;
  }
  return res;
}
struct modint {
  long long n;
  modint() : n(0) { ; }
  modint(long long m) : n(m) {
    if (n >= mod)
      n %= mod;
    else if (n < 0)
      n = (n % mod + mod) % mod;
  }
  operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint& a, modint b) {
  a.n += b.n;
  if (a.n >= mod) a.n -= mod;
  return a;
}
modint operator-=(modint& a, modint b) {
  a.n -= b.n;
  if (a.n < 0) a.n += mod;
  return a;
}
modint operator*=(modint& a, modint b) {
  a.n = ((long long)a.n * b.n) % mod;
  return a;
}
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, long long n) {
  if (n == 0) return modint(1);
  modint res = (a * a) ^ (n / 2);
  if (n % 2) res = res * a;
  return res;
}
long long inv(long long a, long long p) {
  return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }
modint operator/=(modint& a, modint b) {
  a = a / b;
  return a;
}
const int max_n = 1 << 2;
modint fact[max_n], factinv[max_n];
void init_f() {
  fact[0] = modint(1);
  for (int i = 0; i < max_n - 1; i++) {
    fact[i + 1] = fact[i] * modint(i + 1);
  }
  factinv[max_n - 1] = modint(1) / fact[max_n - 1];
  for (int i = max_n - 2; i >= 0; i--) {
    factinv[i] = factinv[i + 1] * modint(i + 1);
  }
}
modint comb(int a, int b) {
  if (a < 0 || b < 0 || a < b) return 0;
  return fact[a] * factinv[b] * factinv[a - b];
}
modint combP(int a, int b) {
  if (a < 0 || b < 0 || a < b) return 0;
  return fact[a] * factinv[a - b];
}
template <typename T, typename U>
struct SegT {
 private:
  int n;
  vector<T> node;
  vector<U> lazy;
  T et;
  U eu;
  function<T(T, T)> f;
  function<T(T, U, int, int)> g;
  function<U(U, U)> h;

 public:
  SegT(vector<T> ori, T _et, U _eu, function<T(T, T)> _f,
       function<T(T, U, int, int)> _g, function<U(U, U)> _h) {
    int sz = ori.size();
    et = _et, eu = _eu;
    f = _f, g = _g, h = _h;
    n = 1;
    while (n < sz) n <<= 1;
    node.resize(2 * n - 1, et);
    lazy.resize(2 * n - 1, eu);
    for (int i = 0; i < sz; i++) {
      node[i + n - 1] = ori[i];
    }
    for (int i = n - 1 - 1; i >= 0; i--) {
      node[i] = f(node[2 * i + 1], node[2 * i + 2]);
    }
  }
  void eval(int k, int l, int r) {
    node[k] = g(node[k], lazy[k], l, r);
    if (r - l > 1) {
      lazy[2 * k + 1] = h(lazy[k], lazy[2 * k + 1]);
      lazy[2 * k + 2] = h(lazy[k], lazy[2 * k + 2]);
    }
    lazy[k] = eu;
  }
  void add(U x, int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    eval(k, l, r);
    if (r <= a || b <= l) return;
    if (a <= l && r <= b) {
      lazy[k] = h(x, lazy[k]);
      eval(k, l, r);
    } else {
      add(x, a, b, k * 2 + 1, l, (l + r) / 2);
      add(x, a, b, k * 2 + 2, (l + r) / 2, r);
      node[k] = f(node[k * 2 + 1], node[k * 2 + 2]);
    }
  }
  T query(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    eval(k, l, r);
    if (r <= a || b <= l) return et;
    if (a <= l && r <= b)
      return node[k];
    else {
      T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
      T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
      return f(vl, vr);
    }
  }
  void update(int loc, T x) {
    int k = 0, l = 0, r = n;
    stack<pair<int, int> > st;
    while (k < n - 1) {
      eval(k, l, r);
      st.push({l, r});
      if (loc < (l + r) / 2) {
        k = 2 * k + 1;
        r = (l + r) / 2;
      } else {
        k = 2 * k + 2;
        l = (l + r) / 2;
      }
    }
    eval(k, l, r);
    st.push({l, r});
    node[k] = x;
    while (k > 0) {
      k = (k - 1) / 2;
      st.pop();
      l = st.top().first, r = st.top().second;
      eval(2 * k + 1, l, (l + r) / 2);
      eval(2 * k + 2, (l + r) / 2, r);
      node[k] = f(node[2 * k + 1], node[2 * k + 2]);
    }
  }
};
using bs = vector<int>;
void add(bs& b, int x) {
  int cur = 30;
  for (int i = 0; i < b.size(); i++) {
    while ((b[i] & (1 << cur)) == 0) cur--;
    if (x >= (1ll << cur + 1)) {
      b.insert(b.begin() + i, x);
      return;
    }
    if (x >= (1 << cur)) x ^= b[i];
  }
  if (x > 0) b.push_back(x);
}
void solve() {
  int n, q;
  cin >> n >> q;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<bs> v(n);
  for (int i = 0; i < n; i++) {
    a[i] ^= (1 << 30);
    add(v[i], a[i]);
  }
  auto f = [&](bs a, bs b) -> bs {
    for (int x : b) add(a, x);
    return a;
  };
  auto g = [&](bs a, int x, int l, int r) -> bs {
    bs res;
    for (int val : a) {
      if (val & (1 << 30))
        add(res, val ^ x);
      else
        add(res, val);
    }
    return res;
  };
  auto h = [&](int a, int b) -> int { return a ^ b; };
  bs init_c;
  SegT<bs, int> st(v, (bs)init_c, 0, f, g, h);
  for (int i = 0; i < q; i++) {
    int t;
    cin >> t;
    if (t == 1) {
      int l, r, x;
      cin >> l >> r >> x;
      l--;
      r--;
      st.add(x, l, r + 1);
    } else {
      int l, r;
      cin >> l >> r;
      l--;
      r--;
      bs b = st.query(l, r + 1);
      bs nex;
      for (int x : b) add(nex, x % (1 << 30));
      int ans = 1;
      for (int i = 0; i < nex.size(); i++) ans *= 2;
      cout << ans << "\n";
    }
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}

```