#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 20;
long long a[N], sum_xor[N];
int n, m, k;
long long flag[N] = {0};
int len;
long long Ans = 0;
long long ans[N];
struct Query {
  int l, r, id, block;
  Query() {}
  Query(int _l, int _r, int _id) : l(_l), r(_r), id(_id) {
    block = _l / len + 1;
  }
} Q[N];
int cmp(Query a, Query b) {
  return (a.block ^ b.block) ? a.block < b.block
         : (a.block & 1)     ? a.r < b.r
                             : a.r > b.r;
}
inline void inser(int x) {
  Ans += flag[sum_xor[x] ^ k];
  flag[sum_xor[x]]++;
}
inline void eras(int x) {
  flag[sum_xor[x]]--;
  Ans -= flag[sum_xor[x] ^ k];
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
    if (i == 1)
      sum_xor[i] = a[i];
    else
      sum_xor[i] = sum_xor[i - 1] ^ a[i];
  }
  len = sqrt(n) + 1;
  int l, r;
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &l, &r);
    Q[i] = Query(l, r, i);
  }
  l = 1;
  r = 0;
  sort(Q + 1, Q + m + 1, cmp);
  flag[0] = 1;
  for (int i = 1; i <= m; i++) {
    while (l < Q[i].l) {
      eras(l - 1);
      l++;
    }
    while (l > Q[i].l) {
      l--;
      inser(l - 1);
    }
    while (r < Q[i].r) inser(++r);
    while (r > Q[i].r) eras(r--);
    ans[Q[i].id] = Ans;
  }
  for (int i = 1; i <= m; i++) {
    printf("%I64d\n", ans[i]);
  }
}
