#include <bits/stdc++.h>
int n, m, k, a[100005];
struct qry {
  int l, r, id;
} q[100005];
inline bool cmp(qry x, qry y) {
  return x.l / 333 != y.l / 333 ? x.l < y.l
                                : ((x.l / 333 & 1) ? x.r > y.r : x.r < y.r);
}
int cnt[1000005 << 1];
long long res;
long long ans[100005];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i] ^= a[i - 1];
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &q[i].l, &q[i].r);
    q[i].l--;
    q[i].id = i;
  }
  std::sort(q + 1, q + m + 1, cmp);
  for (int i = 1, l = 0, r = -1; i <= m; i++) {
    while (r < q[i].r) {
      res += cnt[a[++r] ^ k];
      cnt[a[r]]++;
    }
    while (l > q[i].l) {
      res += cnt[a[--l] ^ k];
      cnt[a[l]]++;
    }
    while (r > q[i].r) {
      cnt[a[r]]--;
      res -= cnt[a[r--] ^ k];
    }
    while (l < q[i].l) {
      cnt[a[l]]--;
      res -= cnt[a[l++] ^ k];
    }
    ans[q[i].id] = res;
  }
  for (int i = 1; i <= m; i++) printf("%lld\n", ans[i]);
}
