#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, m, Max, a[N], opt, x, y;
struct Ask {
  int len1, len2;
  long long num;
  pair<int, int> a[22], b[22];
};
struct Tree {
  int l, r;
  Ask val;
} T[N * 4];
Ask merge(Ask x, Ask y) {
  Ask z;
  z.len1 = x.len1;
  for (int i = 1; i <= x.len1; i++) z.a[i] = x.a[i];
  for (int i = 1; i <= y.len1; i++)
    if ((z.a[z.len1].first | y.a[i].first) == z.a[z.len1].first)
      z.a[z.len1].second += y.a[i].second;
    else
      z.a[++z.len1] = y.a[i], z.a[z.len1].first |= z.a[z.len1 - 1].first;
  z.len2 = y.len2;
  for (int i = 1; i <= y.len2; i++) z.b[i] = y.b[i];
  for (int i = 1; i <= x.len2; i++)
    if ((z.b[z.len2].first | x.b[i].first) == z.b[z.len2].first)
      z.b[z.len2].second += x.b[i].second;
    else
      z.b[++z.len2] = x.b[i], z.b[z.len2].first |= z.b[z.len2 - 1].first;
  z.num = x.num + y.num;
  int sum = 0;
  for (int i = 1, j = y.len1; i <= x.len2; i++) {
    while (j && (x.b[i].first | y.a[j].first) >= Max) sum += y.a[j].second, j--;
    z.num += (long long)sum * x.b[i].second;
  }
  return z;
}
void build(int x, int l, int r) {
  T[x].l = l;
  T[x].r = r;
  if (l == r) {
    T[x].val.num = a[l] >= Max;
    T[x].val.len1 = T[x].val.len2 = 1;
    T[x].val.a[1] = T[x].val.b[1] = make_pair(a[l], 1);
    return;
  }
  int mid = (l + r) / 2;
  build(x * 2, l, mid);
  build(x * 2 + 1, mid + 1, r);
  T[x].val = merge(T[x * 2].val, T[x * 2 + 1].val);
}
void insert(int x, int y, int z) {
  if (T[x].l == T[x].r) {
    T[x].val.num = z >= Max;
    T[x].val.a[1] = T[x].val.b[1] = make_pair(z, 1);
    return;
  }
  int mid = (T[x].l + T[x].r) / 2;
  if (y <= mid)
    insert(x * 2, y, z);
  else
    insert(x * 2 + 1, y, z);
  T[x].val = merge(T[x * 2].val, T[x * 2 + 1].val);
}
Ask find(int x, int l, int r) {
  if (T[x].l >= l && T[x].r <= r) return T[x].val;
  int mid = (T[x].l + T[x].r) / 2;
  if (r <= mid) return find(x * 2, l, r);
  if (l > mid) return find(x * 2 + 1, l, r);
  return merge(find(x * 2, l, mid), find(x * 2 + 1, mid + 1, r));
}
int main() {
  scanf("%d%d%d", &n, &m, &Max);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  build(1, 1, n);
  while (m--) {
    scanf("%d%d%d", &opt, &x, &y);
    if (opt == 1)
      insert(1, x, y);
    else
      printf("%lld\n", find(1, x, y).num);
  }
}
