#include <bits/stdc++.h>
using namespace std;
const int maxn = 1 << 20;
int pos[maxn];
int n, m;
long long k, ans[maxn];
int val[maxn];
struct query {
  int l, r, id;
} Q[maxn];
long long now = 0;
long long M[maxn];
bool cmp(query a, query b) {
  if (pos[a.l] == pos[b.l]) return a.r < b.r;
  return pos[a.l] < pos[b.l];
}
void add(int x) {
  now += M[val[x] ^ k];
  M[val[x]]++;
}
void del(int x) {
  M[val[x]]--;
  now -= M[val[x] ^ k];
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    long long temp;
    scanf("%I64d", &temp);
    val[i] = val[i - 1] ^ temp;
  }
  int block = sqrt(n);
  for (int i = 1; i <= n; i++) pos[i] = i / block;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &Q[i].l, &Q[i].r);
    Q[i].id = i;
  }
  sort(Q + 1, Q + m + 1, cmp);
  M[0] = 1;
  for (int i = 1, L = 1, R = 0; i <= m; i++) {
    for (; R < Q[i].r; R++) add(R + 1);
    for (; R > Q[i].r; R--) del(R);
    for (; L < Q[i].l; L++) del(L - 1);
    for (; L > Q[i].l; L--) add(L - 2);
    ans[Q[i].id] = now;
  }
  for (int i = 1; i <= m; i++) printf("%I64d\n", ans[i]);
}
