#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
const long long M = 3e6 + 5;
long long a[N], pref[N];
long long freq[M];
long long n, m, k, block_sz = 500, x = 0;
struct node {
  long long l, r, idx, ans;
};
node query[N];
bool cmp1(node q1, node q2) {
  long long b1 = q1.l / block_sz, b2 = q2.l / block_sz;
  if (b1 == b2) return q1.r < q2.r;
  return b1 < b2;
}
bool cmp2(node q1, node q2) { return q1.idx < q2.idx; }
void update(long long i, long long sign) {
  if (sign == 1) {
    x += freq[pref[i] ^ k];
    freq[pref[i]]++;
  } else {
    freq[pref[i]]--;
    x -= freq[pref[i] ^ k];
  }
}
void mo() {
  long long moleft = query[0].l, moright = query[0].l - 1;
  for (long long i = 1; i <= m; i++) {
    long long l = query[i].l, r = query[i].r;
    while (moleft < l) {
      update(moleft, -1);
      moleft++;
    }
    while (moleft > l) {
      moleft--;
      update(moleft, 1);
    }
    while (moright > r) {
      update(moright, -1);
      moright--;
    }
    while (moright < r) {
      moright++;
      update(moright, 1);
    }
    query[i].ans = x;
  }
}
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  pref[0] = 0;
  for (long long i = 1; i <= n; i++) pref[i] = pref[i - 1] ^ a[i];
  for (long long i = 1; i <= m; i++) {
    cin >> query[i].l >> query[i].r;
    query[i].l--;
    query[i].idx = i;
  }
  memset(freq, 0, sizeof(freq));
  sort(query + 1, query + m + 1, cmp1);
  mo();
  sort(query + 1, query + m + 1, cmp2);
  for (long long i = 1; i <= m; i++) cout << query[i].ans << '\n';
}
