#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1, c = getchar();
  while (c < 48) c == '-' && (f = -1), c = getchar();
  while (c > 47) x = x * 10 + c - '0', c = getchar();
  return x * f;
}
const long long MAXN = 1200005;
struct Query {
  long long l, r, id, ans;
} q[MAXN];
long long a[MAXN], cnt[MAXN], pos[MAXN];
long long n, m, k, blk;
long long ans;
inline bool cmp(Query a, Query b) {
  return pos[a.l] ^ pos[b.l] ? pos[a.l] < pos[b.l] : a.r < b.r;
}
inline void add(long long x) { ans += (long long)cnt[a[x] ^ k], cnt[a[x]]++; }
inline void del(long long x) { cnt[a[x]]--, ans -= (long long)cnt[a[x] ^ k]; }
int main(int argc, char const *argv[]) {
  n = read();
  m = read();
  k = read();
  blk = sqrt(n);
  for (long long i = 1; i <= n; ++i)
    a[i] = read() ^ a[i - 1], pos[i] = (i - 1) / blk + 1;
  for (long long i = 1; i <= m; ++i)
    q[i].l = read() - 1, q[i].r = read(), q[i].id = i;
  cnt[0] = 1;
  sort(q + 1, q + 1 + m, cmp);
  for (long long i = 1, l = 0, r = 0; i <= m; i++) {
    long long ql = q[i].l, qr = q[i].r;
    while (l < ql) del(l++);
    while (l > ql) add(--l);
    while (r < qr) add(++r);
    while (r > qr) del(r--);
    q[i].ans = ans;
  }
  sort(q + 1, q + 1 + m, [](Query a, Query b) { return a.id < b.id; });
  for (long long i = 1; i <= m; i++) printf("%lld\n", q[i].ans);
  return 0;
}
