#include <bits/stdc++.h>
using namespace std;
struct NODE {
  int l, r, ind;
};
const int N = 100100, L = 2000 * 1000 + 100, SQ = 350;
NODE e[N];
long long ret[N];
int cntl[L], cntr[L], a[N], ps[N];
bool comp(NODE a, NODE b) {
  if (a.l / SQ == b.l / SQ) return (a.r < b.r);
  return (a.l / SQ < b.l / SQ);
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) ps[i] = (ps[i - 1] ^ a[i]);
  for (int i = 0; i < m; i++) {
    cin >> e[i].l >> e[i].r;
    e[i].ind = i;
  }
  sort(e, e + m, comp);
  cntr[ps[0]]++;
  cntl[ps[1]]++;
  int l(1), r(1);
  long long ans = (a[1] == k ? 1 : 0);
  for (int i = 0; i < m; i++) {
    while (r < e[i].r) {
      r++;
      cntr[ps[r - 1]]++;
      cntl[ps[r]]++;
      ans += cntr[(ps[r] ^ k)];
    }
    while (l > e[i].l) {
      l--;
      cntr[ps[l - 1]]++;
      cntl[ps[l]]++;
      ans += cntl[(ps[l - 1] ^ k)];
    }
    while (r > e[i].r) {
      ans -= cntr[(ps[r] ^ k)];
      cntr[ps[r - 1]]--;
      cntl[ps[r]]--;
      r--;
    }
    while (l < e[i].l) {
      ans -= cntl[(ps[l - 1] ^ k)];
      cntr[ps[l - 1]]--;
      cntl[ps[l]]--;
      l++;
    }
    ret[e[i].ind] = ans;
  }
  for (int i = 0; i < m; i++) cout << ret[i] << endl;
  return 0;
}
