#include <bits/stdc++.h>
using namespace std;
void read(long long &x) {
  char ch = getchar();
  x = 0;
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
}
const long long N = 1e5 + 5;
long long n, m, X, a[N];
struct node {
  long long cnt;
  vector<pair<long long, long long> > st, ed;
  void clear() { cnt = 0, st.clear(), ed.clear(); }
};
struct tree {
  node c[N << 2];
  node merge(node a, node b) {
    if (!a.ed.size()) return b;
    if (!b.ed.size()) return a;
    node res;
    res.cnt = a.cnt + b.cnt;
    long long sum = 0;
    for (auto i : a.ed)
      for (auto j : b.st) {
        if ((i.first | j.first) >= X) sum += i.second * j.second;
      }
    res.cnt += sum, res.st = a.st;
    long long tmp = res.st.back().first;
    for (auto i : b.st) {
      if ((i.first | tmp) == tmp)
        res.st.back().second += i.second;
      else
        res.st.push_back({i.first | tmp, i.second}), tmp |= i.first;
    }
    res.ed = b.ed;
    tmp = res.ed.back().first;
    for (auto i : a.ed) {
      if ((i.first | tmp) == tmp)
        res.ed.back().second += i.second;
      else
        res.ed.push_back({i.first | tmp, i.second}), tmp |= i.first;
    }
    return res;
  }
  void push_up(long long p) { c[p] = merge(c[(p << 1)], c[(p << 1 | 1)]); }
  void build(long long p, long long l, long long r) {
    if (l == r) {
      c[p].ed.push_back({a[l], 1});
      c[p].st.push_back({a[l], 1});
      c[p].cnt = (a[l] >= X);
      return;
    }
    long long mid(l + r >> 1);
    build((p << 1), l, mid), build((p << 1 | 1), mid + 1, r);
    push_up(p);
  }
  void modify(long long p, long long l, long long r, long long w, long long v) {
    if (l == r) {
      c[p].clear();
      c[p].st.push_back({v, 1});
      c[p].ed.push_back({v, 1});
      c[p].cnt = (v >= X);
      return;
    }
    long long mid(l + r >> 1);
    if (w <= mid)
      modify((p << 1), l, mid, w, v);
    else
      modify((p << 1 | 1), mid + 1, r, w, v);
    push_up(p);
  }
  node query(long long p, long long l, long long r, long long ql,
             long long qr) {
    if (ql <= l && r <= qr) return c[p];
    long long mid(l + r >> 1);
    node res;
    res.clear();
    if (ql <= mid) res = query((p << 1), l, mid, ql, qr);
    if (qr > mid) res = merge(res, query((p << 1 | 1), mid + 1, r, ql, qr));
    return res;
  }
} t;
signed main() {
  read(n), read(m), read(X);
  for (long long i = 1; i <= n; ++i) read(a[i]);
  t.build(1, 1, n);
  for (long long i = 1, o, w, x, l, r; i <= m; ++i) {
    read(o);
    if (o == 1)
      read(w), read(x), t.modify(1, 1, n, w, x);
    else
      read(l), read(r), printf("%lld\n", t.query(1, 1, n, l, r).cnt);
  }
  return 0;
}
