#include <bits/stdc++.h>
using namespace std;
const int N = 2000010;
int a[N], pos[N], cnt[N];
long long ans[N], res;
struct node {
  int l, r, idx;
  bool operator<(const node& x) const {
    if (pos[l] == pos[x.l]) return r < x.r;
    return l < x.l;
  }
} q[N];
int L, R, n, m, k;
void update(int x, int add) {
  if (add > 0) {
    res += cnt[a[x] ^ k];
    cnt[a[x]]++;
  } else {
    cnt[a[x]]--;
    res -= cnt[a[x] ^ k];
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  int sz = sqrt(n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    a[i] ^= a[i - 1];
    pos[i] = i / sz;
  }
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &q[i].l, &q[i].r);
    q[i].idx = i;
  }
  sort(q + 1, q + m + 1);
  cnt[0] = 1;
  L = 1, R = 0, res = 0;
  for (int i = 1; i <= m; ++i) {
    while (q[i].l < L) update(--L - 1, 1);
    while (q[i].l > L) update(L++ - 1, -1);
    while (q[i].r < R) update(R--, -1);
    while (q[i].r > R) update(++R, 1);
    ans[q[i].idx] = res;
  }
  for (int i = 1; i <= m; ++i) printf("%I64d\n", ans[i]);
  return 0;
}
