#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:10000000000")
using namespace std;
struct query {
  long long l, r, i;
};
const long long MAXN = 1e5 + 10;
query q[MAXN];
long long n, m, k;
long long a[MAXN];
long long pref[MAXN];
long long cnt[1 << 23];
long long B = 333;
long long ans[MAXN];
long long res;
bool cmp(query a, query b) {
  return a.l / B == b.l / B ? a.r < b.r : a.l / B < b.l / B;
}
void add(long long elem) {
  res += cnt[elem ^ k];
  ++cnt[elem];
}
void rem(long long elem) {
  --cnt[elem];
  res -= cnt[elem ^ k];
}
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; ++i) cin >> a[i];
  for (long long i = 1; i <= n; ++i) pref[i] = pref[i - 1] ^ a[i];
  for (long long i = 1; i <= m; ++i) cin >> q[i].l >> q[i].r, q[i].i = i;
  sort(q + 1, q + 1 + m, cmp);
  long long l = 1, r = 1;
  add(pref[1]);
  for (long long i = 1; i <= m; ++i) {
    long long a = q[i].l - 1, b = q[i].r;
    while (r > b) rem(pref[r--]);
    while (r < b) add(pref[++r]);
    while (l < a) rem(pref[l++]);
    while (l > a) add(pref[--l]);
    ans[q[i].i] = res;
  }
  for (long long i = 1; i <= m; ++i) cout << ans[i] << '\n';
  return 0;
}
