#include <bits/stdc++.h>
using namespace std;
struct node {
  int L, R, i;
};
node q[1 << 20];
long long n, m, k;
long long cnt[1 << 20], res;
long long pre[1 << 20], arr[1 << 20], ans[1 << 20];
bool cmp(node x, node y) {
  if ((x.L / 320) != (y.L / 320)) return ((x.L / 320) < (y.L / 320));
  return x.R < y.R;
}
void add(int pos) {
  long long reqd = pre[pos] ^ k;
  res += cnt[reqd];
  cnt[pre[pos]]++;
}
void remove(int pos) {
  cnt[pre[pos]]--;
  long long reqd = pre[pos] ^ k;
  res -= cnt[reqd];
}
int main() {
  int currentL, currentR;
  scanf("%lld", &n);
  scanf("%lld", &m);
  scanf("%lld", &k);
  for (int i = 1; i < n + 1; i++) scanf("%lld", &arr[i]);
  pre[0] = 0;
  for (int i = 1; i < n + 1; i++) pre[i] = pre[i - 1] ^ arr[i];
  for (int i = 0; i < m; i++) {
    scanf("%d", &q[i].L);
    scanf("%d", &q[i].R);
    q[i].L--;
    q[i].i = i;
  }
  sort(q, q + m, cmp);
  cnt[0]++;
  currentL = currentR = 0;
  for (int i = 0; i < m; i++) {
    int L, R;
    L = q[i].L;
    R = q[i].R;
    while (currentL < L) {
      remove(currentL);
      currentL++;
    }
    while (currentL > L) {
      add(currentL - 1);
      currentL--;
    }
    while (currentR < R) {
      currentR++;
      add(currentR);
    }
    while (currentR > R) {
      remove(currentR);
      currentR--;
    }
    ans[q[i].i] = res;
  }
  for (int i = 0; i < m; i++) printf("%lld\n", ans[i]);
  return 0;
}
