#include <bits/stdc++.h>
using namespace std;
const int L = 1e5 + 1;
long long sofar[L], out[L];
struct node {
  long long l, r, q;
};
long long ans = 0, counter[3000002], k;
bool comp(node x, node y) { return x.r < y.r; }
void add(long long val) {
  ans += counter[val ^ k];
  counter[val]++;
  return;
}
void remove(long long val) {
  counter[val]--;
  ans -= counter[val ^ k];
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long a, n, m, cur = 0, l, r;
  cin >> n >> m >> k;
  for (int i = 1; i < n + 1; ++i) {
    cin >> a;
    sofar[i] ^= sofar[i - 1];
    sofar[i] ^= a;
  }
  std::vector<node> v[n / 316 + 5];
  node temp;
  for (int i = 0; i < m; ++i) {
    cin >> l >> r;
    l--, r++;
    temp.l = l, temp.r = r, temp.q = i;
    v[l / 316].push_back(temp);
  }
  for (int i = 0; i < n / 316 + 1; ++i) sort(v[i].begin(), v[i].end(), comp);
  for (int i = 0; i < n / 316 + 3; ++i) {
    l = r = i * 316;
    ans = 0;
    for (auto &x : v[i]) {
      while (r < x.r) {
        add(sofar[r]);
        ++r;
      }
      while (l < x.l) {
        remove(sofar[l]);
        l++;
      }
      while (l > x.l) {
        --l;
        add(sofar[l]);
      }
      out[x.q] = ans;
    }
    for (int j = l; j < r; ++j) remove(sofar[j]);
  }
  for (int i = 0; i < m; ++i) cout << out[i] << "\n";
  return 0;
}
