#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 100;
const int BLOCK_SIZE = 444;
bool cmp(const pair<pair<int, int>, int> &a,
         const pair<pair<int, int>, int> &b) {
  int la = a.first.first, ra = a.first.second;
  int lb = b.first.first, rb = b.first.second;
  if (la / BLOCK_SIZE != lb / BLOCK_SIZE) {
    return la / BLOCK_SIZE < lb / BLOCK_SIZE;
  }
  return ra < rb;
}
int xr[N];
pair<pair<int, int>, int> q[N];
long long res[N];
int cnt[N];
int main() {
  int n, qq, goal;
  scanf("%d %d %d", &n, &qq, &goal);
  xr[0] = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", xr + i);
    xr[i] ^= xr[i - 1];
  }
  for (int i = 0; i < qq; ++i) {
    int l, r;
    scanf("%d %d", &l, &r);
    q[i] = make_pair(make_pair(l, r), i);
  }
  sort(q, q + qq, cmp);
  memset(cnt, 0, sizeof cnt);
  long long ans = 0;
  int l = 0, r = -1;
  for (int i = 0; i < qq; ++i) {
    int nl = q[i].first.first;
    int nr = q[i].first.second;
    while (r < nr) {
      ++r;
      ans += cnt[xr[r] ^ goal];
      ++cnt[xr[r]];
    }
    while (r > nr) {
      --cnt[xr[r]];
      ans -= cnt[xr[r] ^ goal];
      --r;
    }
    while (l < nl - 1) {
      --cnt[xr[l]];
      ans -= cnt[xr[l] ^ goal];
      ++l;
    }
    while (l > nl - 1) {
      --l;
      ans += cnt[xr[l] ^ goal];
      ++cnt[xr[l]];
    }
    res[q[i].second] = ans;
  }
  for (int i = 0; i < qq; ++i) {
    cout << res[i] << '\n';
  }
  return 0;
}
