#include <bits/stdc++.h>
typedef struct {
  int l, r, id;
} Query;
int compareQuery(const void *a, const void *b) {
  Query *p = (Query *)a, *q = (Query *)b;
  if (p->l / 320 == q->l / 320) return p->r - q->r;
  return p->l - q->l;
}
int main() {
  int arr[100010], xorArr[100010], count[1048586];
  int n, m, k, l, r, lptr, rptr;
  int i, j;
  long long int ans, ansArr[100010];
  Query q[100010];
  xorArr[0] = 0;
  scanf("%d %d %d", &n, &m, &k);
  for (i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
    xorArr[i] = xorArr[i - 1] ^ arr[i];
  }
  for (i = 0; i < m; i++) {
    scanf("%d %d", &l, &r);
    q[i].id = i;
    q[i].l = l;
    q[i].r = r;
  }
  qsort(q, m, sizeof(Query), compareQuery);
  memset(count, 0, sizeof(count));
  ans = 0;
  lptr = rptr = 0;
  for (i = 0; i < m; i++) {
    l = q[i].l - 1;
    r = q[i].r;
    while (lptr < l) {
      if (count[xorArr[lptr] ^ k] > 0)
        ans = (k == 0) ? (ans - count[xorArr[lptr] ^ k] + 1)
                       : (ans - count[xorArr[lptr] ^ k]);
      count[xorArr[lptr]]--;
      lptr++;
    }
    while (lptr > l) {
      ans = ans + count[xorArr[lptr - 1] ^ k];
      count[xorArr[lptr - 1]]++;
      lptr--;
    }
    while (rptr <= r) {
      if (count[xorArr[rptr] ^ k] > 0) ans = ans + count[xorArr[rptr] ^ k];
      count[xorArr[rptr]]++;
      rptr++;
    }
    while (rptr > r + 1) {
      ans = (k == 0) ? (ans - count[xorArr[rptr - 1] ^ k] + 1)
                     : (ans - count[xorArr[rptr - 1] ^ k]);
      count[xorArr[rptr - 1]]--;
      rptr--;
    }
    ansArr[q[i].id] = ans;
  }
  for (i = 0; i < m; i++) printf("%lld\n", ansArr[i]);
  return 0;
}
