#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 7;
long long n, m, a[maxn], x;
struct gau {
  long long l, r;
  vector<pair<long long, long long>> vtpre, vtsuf;
  long long sumor, kq;
  gau() {
    l = -1;
    r = -1;
  }
} t[4 * maxn];
gau Merge(gau a, gau b) {
  if (a.l == -1) return b;
  if (b.l == -1) return a;
  gau cur;
  cur.l = a.l;
  cur.r = b.r;
  cur.sumor = a.sumor | b.sumor;
  cur.kq = a.kq + b.kq;
  cur.vtpre = a.vtpre;
  cur.vtsuf = b.vtsuf;
  for (long long i = 0; i < b.vtpre.size(); i++)
    if ((a.sumor | b.vtpre[i].first) != cur.vtpre.back().first)
      cur.vtpre.push_back({(a.sumor | b.vtpre[i].first), b.vtpre[i].second});
  for (long long i = 0; i < a.vtsuf.size(); i++)
    if ((b.sumor | a.vtsuf[i].first) != cur.vtsuf.back().first)
      cur.vtsuf.push_back({(b.sumor | a.vtsuf[i].first), a.vtsuf[i].second});
  long long j = 0;
  for (long long i = b.vtpre.size() - 1; i >= 0; i--) {
    while (j < a.vtsuf.size() && (b.vtpre[i].first | a.vtsuf[j].first) < m) j++;
    if (j < a.vtsuf.size()) {
      long long arest, brest;
      arest = a.vtsuf[j].second - a.l + 1;
      if (i < b.vtpre.size() - 1) {
        brest = b.vtpre[i + 1].second - b.vtpre[i].second;
      } else
        brest = b.r + 1 - b.vtpre[i].second;
      cur.kq += arest * brest;
    }
  }
  return cur;
}
void BuildIT(long long id, long long L, long long R) {
  if (L == R) {
    t[id].l = L;
    t[id].r = R;
    t[id].sumor = a[L];
    t[id].vtpre = {{a[L], L}};
    t[id].vtsuf = {{a[L], L}};
    t[id].kq = (a[L] >= m);
    return;
  }
  long long mid = L + R >> 1;
  BuildIT(id * 2, L, mid);
  BuildIT(id * 2 + 1, mid + 1, R);
  t[id] = Merge(t[id * 2], t[id * 2 + 1]);
}
void Update(long long id, long long L, long long R, long long pos,
            long long vl) {
  if (L == R) {
    t[id].vtpre = {{vl, L}};
    t[id].vtsuf = {{vl, L}};
    t[id].sumor = vl;
    t[id].kq = vl >= m;
    return;
  }
  long long mid = L + R >> 1;
  if (pos <= mid)
    Update(id * 2, L, mid, pos, vl);
  else
    Update(id * 2 + 1, mid + 1, R, pos, vl);
  t[id] = Merge(t[id * 2], t[id * 2 + 1]);
}
gau Query(long long id, long long l, long long r, long long u, long long v) {
  if (l > v || r < u) return gau();
  if (u <= l && r <= v) return t[id];
  long long mid = l + r >> 1;
  return Merge(Query(id * 2, l, mid, u, v),
               Query(id * 2 + 1, mid + 1, r, u, v));
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> x >> m;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  BuildIT(1, 1, n);
  for (long long i = 1; i <= x; i++) {
    long long type, x, y;
    cin >> type >> x >> y;
    if (type == 1)
      Update(1, 1, n, x, y);
    else
      cout << Query(1, 1, n, x, y).kq << '\n';
  }
}
