#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
const int MAXN = 1e5 + 10;
const long long mod = (1ll << 32);
const long long inf = 1e16;
const int N = 1e7 + 1;
struct Query {
  int l, r, id;
};
Query q[MAXN];
long long a[MAXN], p[MAXN], cntl[N], cntr[N], res[MAXN], K = 1000, k, n, Q;
long long ans = 0;
bool cmp(Query a, Query b) {
  if (a.l / K != b.l / K) return a.l < b.l;
  return a.r < b.r;
}
void addL(int id) {
  cntr[p[id]]++;
  cntl[p[id - 1]]++;
  ans += cntr[k ^ p[id - 1]];
}
void addR(int id) {
  cntr[p[id]]++;
  cntl[p[id - 1]]++;
  ans += cntl[k ^ p[id]];
}
void delL(int id) {
  ans -= cntr[k ^ p[id - 1]];
  cntr[p[id]]--;
  cntl[p[id - 1]]--;
}
void delR(int id) {
  ans -= cntl[k ^ p[id]];
  cntr[p[id]]--;
  cntl[p[id - 1]]--;
}
void solve() {
  cin >> n >> Q >> k;
  for (int i = 1; i < n + 1; ++i) {
    cin >> a[i];
    p[i] = p[i - 1] ^ a[i];
  }
  for (int i = 0; i < Q; ++i) {
    int l, r;
    cin >> l >> r;
    q[i] = {l, r, i};
  }
  sort(q, q + Q, cmp);
  int L = 1, R = 0;
  for (int i = 0; i < Q; ++i) {
    int l = q[i].l, r = q[i].r, id = q[i].id;
    while (L > l) addL(--L);
    while (R < r) addR(++R);
    while (L < l) delL(L++);
    while (R > r) delR(R--);
    res[id] = ans;
  }
  for (int i = 0; i < Q; ++i) cout << res[i] << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();
}
