#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
long long ans[maxn], now;
int n, m, k, len, a[maxn], p[maxn], cnt[maxn * 20];
struct node {
  int l, r, id;
} b[maxn];
int read() {
  int x = 0;
  char c = getchar();
  while (c < 48 || c > 57) c = getchar();
  while (c >= 48 && c <= 57) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  return x;
}
bool cmp(const node &a, const node &b) {
  return (p[a.l] ^ p[b.l]) ? (p[a.l] < p[b.l])
                           : ((p[a.l] & 1) ? a.r < b.r : a.r > b.r);
}
void add(int x) {
  now += cnt[a[x] ^ k];
  cnt[a[x]]++;
}
void del(int x) {
  cnt[a[x]]--;
  now -= cnt[a[x] ^ k];
}
int main() {
  int i, l, r;
  n = read(), m = read(), k = read();
  len = sqrt(n);
  for (i = 1; i <= n; i++) {
    a[i] = read() ^ a[i - 1];
    p[i] = (i - 1) / len + 1;
  }
  for (i = 1; i <= m; i++) b[i] = (node){read() - 1, read(), i};
  sort(b + 1, b + m + 1, cmp);
  l = 1, r = 0;
  for (i = 1; i <= m; i++) {
    while (l < b[i].l) del(l++);
    while (l > b[i].l) add(--l);
    while (r < b[i].r) add(++r);
    while (r > b[i].r) del(r--);
    ans[b[i].id] = now;
  }
  for (i = 1; i <= m; i++) printf("%lld\n", ans[i]);
  return 0;
}
