#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const long long N = 1e5 + 10;
long long n, m, bl, a[N], cnt[N * 20], k, res[N], s, cl = 1, cr;
struct node {
  long long l, r, id;
} t[N];
long long cmp(const node &s1, const node &s2) {
  return (s1.l / bl == s2.l / bl) ? (s1.r < s2.r) : (s1.l < s2.l);
}
inline void add(long long x) {
  s += cnt[k ^ a[x]];
  cnt[a[x]]++;
}
inline void del(long long x) {
  cnt[a[x]]--;
  s -= cnt[k ^ a[x]];
}
signed main() {
  scanf("%lld %lld %lld", &n, &m, &k);
  bl = sqrt(n);
  for (long long i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (long long i = 1; i <= n; i++) a[i] ^= a[i - 1];
  for (long long i = 1; i <= m; i++)
    scanf("%lld %lld", &t[i].l, &t[i].r), t[i].id = i, t[i].l--;
  sort(t + 1, t + 1 + m, cmp);
  for (long long i = 1; i <= m; i++) {
    long long L = t[i].l;
    long long R = t[i].r;
    while (cr < R) add(++cr);
    while (cl > L) add(--cl);
    while (cr > R) del(cr--);
    while (cl < L) del(cl++);
    res[t[i].id] = s;
  }
  for (long long i = 1; i <= m; i++) printf("%lld\n", res[i]);
  return 0;
}
