#include <bits/stdc++.h>
using namespace std;
const long long N = 3e6 + 9;
long long a[N], n, m, x, y, z, op, now, k, len, bnum, belong[N], ans[N], cnt[N];
struct query {
  long long l, r, id;
} Q[N];
inline long long read() {
  long long res = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    res = (res << 1) + (res << 3) + ch - '0';
    ch = getchar();
  }
  return res * f;
}
bool cmp(query a, query b) {
  return belong[a.l] ^ belong[b.l] ? belong[a.l] < belong[b.l] : a.r < b.r;
}
bool cmp1(query a, query b) {
  return a.l / len == b.l / len ? a.r < b.r : a.l / len < b.l / len;
}
inline void del(long long p) {
  cnt[a[p]]--;
  now -= cnt[a[p] ^ k];
}
inline void add(long long p) {
  now += cnt[a[p] ^ k];
  cnt[a[p]]++;
}
signed main() {
  n = read(), m = read(), k = read();
  len = sqrt(n);
  for (long long i = 1; i <= n; i++) a[i] = read(), a[i] ^= a[i - 1];
  for (long long i = 1; i <= m; i++) {
    Q[i].l = read(), Q[i].r = read();
    Q[i].id = i;
  }
  sort(Q + 1, Q + 1 + m, cmp1);
  long long l = 1, r = 0;
  cnt[0] = 1;
  for (long long i = 1; i <= m; i++) {
    long long ql = Q[i].l, qr = Q[i].r;
    while (r < qr) add(++r);
    while (l < ql) del(l - 1), l++;
    while (l > ql) --l, add(l - 1);
    while (r > qr) del(r--);
    ans[Q[i].id] = now;
  }
  for (long long i = 1; i <= m; i++) printf("%lld\n", ans[i]);
  return 0;
}
