#include <bits/stdc++.h>
using namespace std;
const long long bl_size = 320;
int n, m;
long long k;
long long res;
long long a[100005];
unordered_map<long long, long long> cnt;
struct Query {
  int l, r, id;
  bool operator<(Query other) const {
    if (l / bl_size != other.l / bl_size)
      return l < other.l;
    else
      return (l / bl_size & 1) ? (r < other.r) : (r > other.r);
  }
};
void add(long long x) {
  long long y = x ^ k;
  res += cnt[y];
  cnt[x]++;
}
void rem(long long x) {
  long long y = x ^ k;
  if (y != x)
    res -= (cnt[y]);
  else
    res -= (cnt[y] - 1);
  cnt[x]--;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  scanf("%d%d%d", &n, &m, &k);
  long long prev[n + 10];
  prev[0] = 0;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), prev[i] = prev[i - 1] ^ a[i];
  Query q[100005];
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &q[i].l, &q[i].r);
    q[i].l--;
    q[i].id = i;
  }
  sort(q + 1, q + n + 1);
  res = 0;
  long long ans[m + 10];
  int cur_l = 0, cur_r = -1;
  for (int i = 1; i <= m; i++) {
    while (cur_l > q[i].l) {
      cur_l--;
      add(prev[cur_l]);
    }
    while (cur_l < q[i].l) {
      rem(prev[cur_l]);
      cur_l++;
    }
    while (cur_r > q[i].r) {
      rem(prev[cur_r]);
      cur_r--;
    }
    while (cur_r < q[i].r) {
      cur_r++;
      add(prev[cur_r]);
    }
    ans[q[i].id] = res;
  }
  for (int i = 1; i <= m; i++) cout << ans[i] << endl;
}
