#include <bits/stdc++.h>
using namespace std;
long long blk = 300;
struct data {
  long long l, r, i;
  data() { l = r = i = 0; }
  data(long long v1, long long v2, long long v3) {
    l = v1;
    r = v2;
    i = v3;
  }
  bool operator<(const data &x) const {
    if (l / blk != x.l / blk)
      return (l / blk < x.l / blk);
    else
      return (r < x.r);
  }
};
long long num[100005], num2[100005];
data query[100005];
long long freq[1048600], freq2[1048600];
long long output[100005];
int main() {
  long long a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t;
  scanf("%lld %lld %lld", &a, &b, &c);
  num[0] = 0;
  for (i = 1; i <= a; i++) {
    scanf("%lld", &num[i]);
    num2[i] = num[i];
    num[i] ^= num[i - 1];
  }
  for (i = a - 1; i >= 1; i--) num2[i] ^= num2[i + 1];
  for (i = 1; i <= b; i++) {
    scanf("%lld %lld", &d, &e);
    query[i] = data(d, e, i);
  }
  sort(query + 1, query + b + 1);
  memset(freq, 0, sizeof(freq));
  l = 1;
  r = 0;
  long long ans = 0;
  num[a + 1] = 0;
  freq[0]++;
  freq2[num2[1]]++;
  for (i = 1; i <= b; i++) {
    freq2[num2[r + 1]]--;
    while (r < query[i].r) {
      r++;
      ans += freq[c ^ num[r]];
      freq[num[r]]++;
      freq2[num2[r]]++;
    }
    while (r > query[i].r) {
      freq[num[r]]--;
      freq2[num2[r]]--;
      ans -= freq[c ^ num[r]];
      r--;
    }
    freq2[num2[r + 1]]++;
    freq[num[l - 1]]--;
    while (l < query[i].l) {
      freq2[num2[l]]--;
      freq[num[l]]--;
      ans -= freq2[c ^ num2[l]];
      l++;
    }
    while (l > query[i].l) {
      l--;
      ans += freq2[c ^ num2[l]];
      freq2[num2[l]]++;
      freq[num[l]]++;
    }
    freq[num[l - 1]]++;
    output[query[i].i] = ans;
  }
  for (i = 1; i <= b; i++) {
    printf("%lld\n", output[i]);
  }
  return 0;
}
