#include <bits/stdc++.h>
using namespace std;
int blk_size;
struct node {
  int l, r, id;
  long long int ans = 0;
};
bool compare(node a, node b) {
  if (a.l / blk_size != b.l / blk_size)
    return (a.l) / blk_size < (b.l) / blk_size;
  return a.r < b.r;
}
bool compare2(node a, node b) { return a.id < b.id; }
long long int freq[3000001];
int main() {
  ios_base::sync_with_stdio(false);
  ;
  int n, m, k;
  cin >> n >> m >> k;
  std::vector<int> a(n), pxor(n + 1);
  for (int i = 0; i < n; i++) cin >> a[i];
  pxor[0] = 0;
  for (int i = 1; i <= n; i++) pxor[i] = pxor[i - 1] ^ a[i - 1];
  blk_size = sqrt(n + 1);
  std::vector<node> q(m);
  for (int i = 0; i < m; i++) {
    cin >> q[i].l >> q[i].r;
    q[i].id = i;
  }
  sort(q.begin(), q.end(), compare);
  int start = 0, end = 0;
  long long int ans = 0;
  freq[0] = 1;
  for (int i = 0; i < m; i++) {
    int l = q[i].l - 1, r = q[i].r;
    while (start > l) {
      start--;
      ans += freq[pxor[start] ^ k];
      freq[pxor[start]]++;
    }
    while (start < l) {
      freq[pxor[start]]--;
      ans -= freq[pxor[start] ^ k];
      start++;
    }
    while (end > r) {
      freq[pxor[end]]--;
      ans -= freq[pxor[end] ^ k];
      end--;
    }
    while (end < r) {
      end++;
      ans += freq[pxor[end] ^ k];
      freq[pxor[end]]++;
    }
    q[i].ans = ans;
  }
  sort(q.begin(), q.end(), compare2);
  for (int i = 0; i < m; i++) printf("%lld\n", q[i].ans);
  return 0;
}
