#include <bits/stdc++.h>
using namespace std;
namespace zzc {
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  return x * f;
}
const long long maxn = 1e5 + 5;
const long long maxm = 4e6 + 5;
const long long blo = 350;
long long n, cnt = 1, qt, k, num;
long long bel[maxn], a[maxn], pre[maxn], ans[maxn], t[maxm];
struct que {
  long long l, r, id;
  bool operator<(const que &b) const {
    return bel[l] == bel[b.l] ? r < b.r : l < b.l;
  }
} q[maxn];
void add(int x) {
  int tmp = pre[x] ^ k;
  num += t[tmp];
  t[pre[x]]++;
}
void del(int x) {
  int tmp = pre[x] ^ k;
  t[pre[x]]--;
  num -= t[tmp];
}
void work() {
  n = read();
  qt = read();
  k = read();
  for (register int i = 1; i <= n; i++) {
    a[i] = read();
    pre[i] = pre[i - 1] ^ a[i];
    if (i % blo == 0) cnt++;
    bel[i] = cnt;
  }
  for (register int i = 1; i <= qt; i++) {
    q[i].l = read() - 1;
    q[i].r = read();
    q[i].id = i;
  }
  sort(q + 1, q + qt + 1);
  int l = 0, r = 0;
  t[0] = 1;
  for (register int i = 1; i <= qt; i++) {
    while (q[i].l < l) add(--l);
    while (q[i].r > r) add(++r);
    while (q[i].l > l) del(l++);
    while (q[i].r < r) del(r--);
    ans[q[i].id] = num;
  }
  for (register int i = 1; i <= qt; i++) printf("%lld ", ans[i]);
}
}  // namespace zzc
int main() {
  zzc::work();
  return 0;
}
