#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, MAXA = 2000010;
int n, q, k, a[N], belong[N], cnt[MAXA];
long long now, ans[N];
struct pos {
  int l, r, id;
} ask[N];
void add(int x) {
  now += cnt[x ^ k];
  cnt[x]++;
}
void del(int x) {
  cnt[x]--;
  now -= cnt[x ^ k];
}
bool cmp(pos x, pos y) {
  return belong[x.l] == belong[y.l] ? x.r < y.r : belong[x.l] < belong[y.l];
}
int main() {
  scanf("%d%d%d", &n, &q, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), a[i] ^= a[i - 1];
  for (int i = 1; i <= q; i++)
    scanf("%d%d", &ask[i].l, &ask[i].r), ask[i].l--, ask[i].id = i;
  int sz = sqrt(n), num = ceil(n * 1.0 / sz);
  for (int i = 1; i <= num; i++) {
    int tmp = min(i * sz, n);
    for (int j = (i - 1) * sz + 1; j <= tmp; j++) belong[j] = i;
  }
  sort(ask + 1, ask + q + 1, cmp);
  int l = 1, r = 0;
  for (int i = 1; i <= q; i++) {
    int ql = ask[i].l, qr = ask[i].r;
    while (l < ql) del(a[l++]);
    while (l > ql) add(a[--l]);
    while (r < qr) add(a[++r]);
    while (r > qr) del(a[r--]);
    ans[ask[i].id] = now;
  }
  for (int i = 1; i <= q; i++) printf("%lld\n", ans[i]);
  return 0;
}
