#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int n, m;
long long a[MAXN], x;
struct node {
  long long ans;
  vector<pair<long long, long long> > pref, suf;
} seg[MAXN * 3];
node merge(node xl, node xr) {
  if (xl.pref.empty()) return xr;
  if (xr.pref.empty()) return xl;
  node xp;
  xp.ans = xl.ans + xr.ans;
  for (int i = 0; i < xl.suf.size(); i++) {
    pair<long long, long long> p = xl.suf[i];
    for (int j = 0; j < xr.pref.size(); j++) {
      pair<long long, long long> p2 = xr.pref[j];
      if ((p.first | p2.first) >= x) xp.ans += p.second * p2.second;
    }
  }
  xp.pref = xl.pref;
  for (int i = 0; i < xr.pref.size(); i++) {
    pair<long long, long long> p = xr.pref[i];
    if (xp.pref.empty() || ((xp.pref.back().first & p.first) != p.first))
      xp.pref.push_back(
          {(xp.pref.size() ? xp.pref.back().first : 0LL) | p.first, p.second});
    else
      xp.pref.back().second += p.second;
  }
  xp.suf = xr.suf;
  for (int i = 0; i < xl.suf.size(); i++) {
    pair<long long, long long> p = xl.suf[i];
    if (xp.suf.empty() || ((xp.suf.back().first & p.first) != p.first))
      xp.suf.push_back(
          {(xp.suf.size() ? xp.suf.back().first : 0LL) | p.first, p.second});
    else
      xp.suf.back().second += p.second;
  }
  return xp;
}
node get(int l, int r, int b = 0, int e = n, int id = 1) {
  if (l <= b && e <= r) return seg[id];
  int mid = (b + e) / 2;
  if (r <= mid) return get(l, r, b, mid, id * 2);
  if (l >= mid) return get(l, r, mid, e, id * 2 + 1);
  return merge(get(l, r, b, mid, id * 2), get(l, r, mid, e, id * 2 + 1));
}
void add(int ind, long long val, int b = 0, int e = n, int id = 1) {
  if (b + 1 == e) {
    seg[id].pref.clear(), seg[id].suf.clear();
    seg[id].pref.push_back({val, 1}), seg[id].suf.push_back({val, 1});
    seg[id].ans = (val >= x);
    return;
  }
  int mid = (b + e) / 2;
  if (ind < mid)
    add(ind, val, b, mid, id * 2);
  else
    add(ind, val, mid, e, id * 2 + 1);
  seg[id] = merge(seg[id * 2], seg[id * 2 + 1]);
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> x;
  for (int i = 0; i < n; i++) cin >> a[i], add(i, a[i]);
  seg[0].ans = 0;
  while (m) {
    m--;
    int ty, l, r, y, ind;
    cin >> ty;
    if (ty == 1) {
      cin >> ind >> y, ind--;
      a[ind] = y;
      add(ind, y);
    } else {
      cin >> l >> r, l--;
      cout << get(l, r).ans << endl;
    }
  }
  return 0;
}
