#include <bits/stdc++.h>
using namespace std;
int a[100007];
int pref[100007], suff[100007];
struct data {
  int l, r, id;
  bool operator<(const data& p) const {
    if (l / 317 == p.l / 317) return r < p.r;
    return l / 317 < p.l / 317;
  }
};
data qr[100007];
long long ans[100007];
long long p[4000007], s[4000007];
int main(void) {
  int n, m, k, i;
  scanf("%d %d %d", &n, &m, &k);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    pref[i] = pref[i - 1] ^ a[i];
  }
  for (i = n; i; i--) suff[i] = suff[i + 1] ^ a[i];
  for (i = 0; i < m; i++) {
    qr[i].id = i;
    scanf("%d %d", &qr[i].l, &qr[i].r);
  }
  sort(qr, qr + m);
  int L, R;
  long long cnt;
  L = 1;
  R = 0;
  cnt = 0;
  p[0] = 1;
  s[suff[1]] = 1;
  for (i = 0; i < m; i++) {
    while (R < qr[i].r) {
      R++;
      cnt += p[pref[R] ^ k];
      p[pref[R]]++;
      s[suff[R + 1]]++;
    }
    while (qr[i].l < L) {
      L--;
      cnt += s[suff[L] ^ k];
      p[pref[L - 1]]++;
      s[suff[L]]++;
    }
    while (qr[i].r < R) {
      p[pref[R]]--;
      s[suff[R + 1]]--;
      cnt -= p[pref[R] ^ k];
      R--;
    }
    while (L < qr[i].l) {
      p[pref[L - 1]]--;
      s[suff[L]]--;
      cnt -= s[suff[L] ^ k];
      L++;
    }
    ans[qr[i].id] = cnt;
  }
  for (i = 0; i < m; i++) printf("%lld\n", ans[i]);
  return 0;
}
