#include <bits/stdc++.h>
using namespace std;
const int up = 1 << 22;
int cont[up], pre[up], data[up];
int n, m, k;
struct query {
  int l, r, ind;
  bool operator<(const query o) const { return r < o.r; }
};
const int size = 316;
long long res = 0;
void add(int v) {
  res += cont[v ^ k];
  cont[v]++;
}
void del(int v) {
  cont[v]--;
  res -= cont[v ^ k];
}
vector<vector<query> > mq(400, vector<query>());
long long ans[up];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &data[i]);
    pre[i] = pre[i - 1] ^ data[i];
  }
  for (int i = 1; i <= m; i++) {
    query tep;
    scanf("%d%d", &tep.l, &tep.r);
    tep.ind = i;
    mq[(tep.l - 1) / size].push_back(tep);
  }
  for (int i = 0; i < mq.size(); i++) {
    sort(mq[i].begin(), mq[i].end());
    if (mq[i].size() == 0) {
      continue;
    }
    add(pre[i * size]);
    int left, right;
    left = right = i * size;
    for (auto t : mq[i]) {
      while (right < t.r) {
        right++;
        add(pre[right]);
      }
      while (left >= t.l) {
        left--;
        add(pre[left]);
      }
      while (left < t.l - 1) {
        del(pre[left]);
        left++;
      }
      ans[t.ind] = res;
    }
    while (left <= right) {
      del(pre[left]);
      left++;
    }
  }
  for (int i = 1; i <= m; i++) {
    printf("%I64d\n", ans[i]);
  }
  return 0;
}
