#include <bits/stdc++.h>
using namespace std;
const int mxn = 100003;
long long f[20 * mxn + 10], rs[2 * mxn], ar[mxn + 10];
long long sum = 0;
int n, m, k;
struct data {
  int l, r, id;
} query[mxn];
int bs = sqrt(mxn * 14);
bool operator<(data a, data b) {
  return a.l / bs == b.l / bs ? a.r < b.r : a.l < b.l;
}
void add(int pos) {
  sum += f[ar[pos] ^ k];
  f[ar[pos]]++;
}
void rmv(int pos) {
  f[ar[pos]]--;
  sum -= f[ar[pos] ^ k];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> ar[i];
  for (int i = 1; i <= n; i++) {
    ar[i] = ar[i - 1] ^ ar[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> query[i].l >> query[i].r;
    query[i].l--;
    query[i].id = i;
  }
  sort(query, query + m);
  int left = 1, right = 1;
  add(1);
  for (int i = 0; i < m; i++) {
    while (left < query[i].l) {
      rmv(left);
      left++;
    }
    while (left > query[i].l) {
      left--;
      add(left);
    }
    while (right < query[i].r) {
      right++;
      add(right);
    }
    while (right > query[i].r) {
      rmv(right);
      right--;
    }
    rs[query[i].id] = sum;
  }
  for (int i = 0; i < m; i++) {
    cout << rs[i] << endl;
  }
  return 0;
}
