#include <bits/stdc++.h>
using namespace std;
mt19937 gen(chrono::system_clock::now().time_since_epoch().count());
const int M = 1e9 + 7;
const int FFTM = 998244353;
const int N = 1e5 + 7;
int X;
struct node {
  long long res;
  vector<pair<int, int> > pref, suff;
  node() { res = 0; }
  node(int x) {
    res = (x >= X);
    pref.push_back({x, 1});
    suff.push_back({x, 1});
  }
  node operator+(const node &r) {
    node ret;
    ret.res = res + r.res;
    ret.pref = pref;
    for (auto it : r.pref) {
      if (!ret.pref.empty() &&
          (it.first | ret.pref.back().first) == ret.pref.back().first)
        ret.pref.back().second += it.second;
      else
        ret.pref.push_back(
            {it.first | (ret.pref.empty() ? 0 : ret.pref.back().first),
             it.second});
    }
    ret.suff = r.suff;
    for (auto it : suff) {
      if (!ret.suff.empty() &&
          (it.first | ret.suff.back().first) == ret.suff.back().first)
        ret.suff.back().second += it.second;
      else
        ret.suff.push_back(
            {it.first | (ret.suff.empty() ? 0 : ret.suff.back().first),
             it.second});
    }
    int j = suff.size() - 1;
    int cur = 0;
    for (auto it : r.pref) {
      while (j >= 0 && (it.first | suff[j].first) >= X) cur += suff[j--].second;
      ret.res += 1ll * it.second * cur;
    }
    return ret;
  }
};
struct segtree {
  int tn = 1;
  vector<node> t;
  void resize(int n) {
    tn = 1;
    while (tn <= n) tn <<= 1;
    t.resize(tn << 1 | 1);
  }
  segtree() {}
  void upd(int p, int x) {
    for (t[p += tn] = node(x); p > 1; p >>= 1)
      t[p >> 1] = ((p & 1) ? t[p ^ 1] + t[p] : t[p] + t[p ^ 1]);
  }
  node q(int v, int tl, int tr, int l, int r) {
    if (tr <= l || r <= tl) return node();
    if (l <= tl && tr <= r) return t[v];
    int m = (tl + tr) >> 1;
    return q(v << 1, tl, m, l, r) + q(v << 1 | 1, m, tr, l, r);
  }
  node q(int l, int r) { return q(1, 0, tn, l, r); }
};
int n, q, p, x, l, r, T;
segtree t;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> q >> X;
  t.resize(n);
  for (int i = 0; i < n; i++) cin >> x, t.upd(i, x);
  while (q--) {
    cin >> T;
    if (T == 1) {
      cin >> p >> x;
      p--;
      t.upd(p, x);
    }
    if (T == 2) {
      cin >> l >> r;
      l--;
      cout << t.q(l, r).res << '\n';
    }
  }
  return 0;
}
