#include <bits/stdc++.h>
using namespace std;
int v[100001];
int acum[100001];
long long cnt = 0, ans[100001];
struct Q {
  int i, j, p;
  Q(int a, int b, int c) : i(a), j(b), p(c){};
  Q() {}
  bool operator<(const Q &other) const {
    if (i / 300 == other.i / 300) return j < other.j;
    return i / 300 < other.i / 300;
  }
};
vector<Q> queries;
int freq[2097151];
int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", v + i);
    acum[i] = v[i] ^ acum[i - 1];
  }
  for (int k = 0; k < m; k++) {
    int i, j;
    scanf("%d %d", &i, &j);
    queries.push_back(Q(i - 1, j, k));
  }
  sort(queries.begin(), queries.end());
  int l = 0, r = 0;
  freq[0] = 1;
  for (int q = 0; q < m; q++) {
    int i = queries[q].i, j = queries[q].j, p = queries[q].p;
    while (l > i) {
      --l;
      cnt += freq[acum[l] ^ k];
      freq[acum[l]]++;
    }
    while (r < j) {
      r++;
      cnt += freq[acum[r] ^ k];
      freq[acum[r]]++;
    }
    while (l < i) {
      freq[acum[l]]--;
      cnt -= freq[acum[l] ^ k];
      l++;
    }
    while (r > j) {
      freq[acum[r]]--;
      cnt -= freq[acum[r] ^ k];
      r--;
    }
    ans[p] = cnt;
  }
  for (int i = 0; i < m; i++) printf("%lld\n", ans[i]);
  return 0;
}
