#include <bits/stdc++.h>
using namespace std;
long long int an, cn[10000010], ans[100001];
int s, k, ar[100001];
struct info {
  int l, r, v;
} pr[200001];
bool comp(info x, info y) {
  if (x.l / s == y.l / s)
    return x.r < y.r;
  else
    return x.l / s < y.l / s;
}
void add(int position) {
  an += cn[k ^ ar[position]];
  cn[ar[position]]++;
}
void remove(int position) {
  cn[ar[position]]--;
  an -= cn[k ^ ar[position]];
}
int main() {
  int n, i, j, m, L, R;
  scanf("%d%d%d", &n, &m, &k);
  for (i = 1; i <= n; i++) scanf("%d", &ar[i]);
  ar[0] = 0;
  for (int i = 1; i <= n; i++) ar[i] = ar[i] ^ ar[i - 1];
  int currentL = 0;
  int currentR = -1;
  an = 0;
  for (i = 0; i < m; i++) {
    scanf("%d%d", &pr[i].l, &pr[i].r);
    pr[i].l--;
    pr[i].r;
    pr[i].v = i;
  }
  s = sqrt(n);
  sort(pr, pr + m, comp);
  an = 0;
  for (i = 0; i < m; i++) {
    L = pr[i].l;
    R = pr[i].r;
    while (currentL < L) {
      remove(currentL);
      currentL++;
    }
    while (currentL > L) {
      add(currentL - 1);
      currentL--;
    }
    while (currentR < R) {
      add(currentR + 1);
      currentR++;
    }
    while (currentR > R) {
      remove(currentR);
      currentR--;
    }
    ans[pr[i].v] = an;
  }
  for (i = 0; i < m; i++) printf("%I64d\n", ans[i]);
}
