#include <bits/stdc++.h>
using namespace std;
int r[100050], arr[100050], temp[1 << 20], k;
long long res;
vector<pair<pair<int, int>, int> > in[100050];
long long ans[100050];
void add(int a) {
  res += temp[a ^ k];
  temp[a]++;
}
void del(int a) {
  temp[a]--;
  res -= temp[a ^ k];
}
bool fun(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  if (a.first.second < b.first.second) return true;
  return false;
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  ;
  scanf("%d", &k);
  int second = (int)sqrt(n);
  for (int i = 1; i <= n; i++) scanf("%d", &arr[i]);
  for (int i = 1; i <= n; i++) r[i] = r[i - 1] ^ arr[i];
  for (int i = 0; i < m; i++) {
    int a, b, c;
    scanf("%d %d", &a, &b);
    ;
    a--;
    in[a / second].push_back(make_pair(make_pair(a, b), i));
  }
  for (int i = 0; i < second + 2; i++) sort(in[i].begin(), in[i].end(), fun);
  int a, b;
  for (int i = 0; i < second + 2; i++) {
    a = b = i * second;
    int p = in[i].size();
    for (int j = 0; j < p; j++) {
      while (b <= in[i][j].first.second) {
        add(r[b]);
        b++;
      }
      while (a < in[i][j].first.first) {
        del(r[a]);
        a++;
      }
      a--;
      while (a >= in[i][j].first.first) {
        add(r[a]);
        a--;
      }
      a++;
      ans[in[i][j].second] = res;
    }
    for (int j = a; j < b; j++) del(r[j]);
  }
  for (int i = 0; i < m; i++) printf("%lld\n", ans[i]);
  return 0;
}
