#include <bits/stdc++.h>
using namespace std;
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 - '0';
    ch = getchar();
  }
  return x * f;
}
long long n, m, block, tmp, k;
long long a[2000005], ans[2000005];
long long cnt[2000005];
struct Query {
  long long l, r, id, pos;
} q[2000005];
inline bool cmp(Query A, Query B) {
  return A.pos == B.pos ? (A.pos & 1 ? A.r < B.r : A.r > B.r) : A.pos < B.pos;
}
inline void del(long long p) {
  cnt[a[p]]--;
  tmp -= cnt[a[p] ^ k];
}
inline void ins(long long p) {
  tmp += cnt[a[p] ^ k];
  cnt[a[p]]++;
}
signed main() {
  n = read(), m = read(), k = read();
  block = sqrt(n);
  for (long long i = 1; i <= n; i++) {
    a[i] = a[i - 1] ^ read();
  }
  for (long long i = 1; i <= m; i++) {
    q[i].l = read() - 1, q[i].r = read();
    q[i].pos = q[i].l / block, q[i].id = i;
  }
  sort(q + 1, q + 1 + m, cmp);
  cnt[0] = 1;
  long long l = 0, r = 0;
  for (long long i = 1; i <= m; i++) {
    while (l < q[i].l) del(l++);
    while (l > q[i].l) ins(--l);
    while (r < q[i].r) ins(++r);
    while (r > q[i].r) del(r--);
    ans[q[i].id] = tmp;
  }
  for (long long i = 1; i <= m; i++) {
    printf("%lld\n", ans[i]);
  }
  return 0;
}
