#include <bits/stdc++.h>
using namespace std;
const int N = 100002;
int n, a[N], m, x;
struct node {
  long long ans = 0;
  vector<pair<int, int> > pref, suf;
} tree[N << 2];
void merge_nodes(const node &a, const node &b, node &c) {
  if (a.pref.empty()) {
    c = b;
    return;
  }
  if (b.pref.empty()) {
    c = a;
    return;
  }
  c.ans = a.ans + b.ans;
  for (pair<int, int> pr : b.pref) {
    for (pair<int, int> su : a.suf)
      if ((pr.first | su.first) >= x) c.ans += 1ll * pr.second * su.second;
  }
  c.pref = a.pref;
  for (pair<int, int> p : b.pref) {
    p.first |= a.pref.back().first;
    if (c.pref.empty() || c.pref.back().first != p.first)
      c.pref.push_back(p);
    else
      c.pref.back().second += p.second;
  }
  c.suf = b.suf;
  for (pair<int, int> su : a.suf) {
    su.first |= b.pref.back().first;
    if (c.suf.empty() || c.suf.back().first != su.first)
      c.suf.push_back(su);
    else
      c.suf.back().second += su.second;
  }
}
void build(int l, int r, int i) {
  if (l == r) {
    tree[i].pref.push_back({a[l], 1}), tree[i].suf.push_back({a[l], 1});
    tree[i].ans = a[l] >= x;
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, i << 1), build(mid + 1, r, (i << 1) | 1);
  merge_nodes(tree[i << 1], tree[(i << 1) | 1], tree[i]);
}
void update(int l, int r, int i, int idx, int val) {
  if (idx < l || r < idx) return;
  if (l == r) {
    tree[i].pref.clear(), tree[i].suf.clear();
    tree[i].pref.push_back({val, 1}), tree[i].suf.push_back({val, 1});
    tree[i].ans = val >= x;
    return;
  }
  int mid = (l + r) >> 1;
  update(l, mid, i << 1, idx, val), update(mid + 1, r, (i << 1) | 1, idx, val);
  merge_nodes(tree[i << 1], tree[(i << 1) | 1], tree[i]);
}
node query(int l, int r, int i, int S, int E) {
  if (E < l || r < S) return node();
  if (S <= l && r <= E) return tree[i];
  int mid = (l + r) >> 1;
  node r1 = query(l, mid, i << 1, S, E);
  node r2 = query(mid + 1, r, (i << 1) | 1, S, E);
  node ret;
  merge_nodes(r1, r2, ret);
  return ret;
}
int main() {
  scanf("%d%d%d", &n, &m, &x);
  for (int(i) = (1); (i) <= (int)(n); (i)++) scanf("%d", &a[i]);
  build(1, n, 1);
  while (m--) {
    int t, x, y;
    scanf("%d%d%d", &t, &x, &y);
    if (t == 1) {
      update(1, n, 1, x, y);
    } else {
      printf("%lld\n", query(1, n, 1, x, y).ans);
    }
  }
  return 0;
}
