#include <bits/stdc++.h>
using namespace std;
const int len = 300;
int cnt[1049000], a[100010];
struct query {
  int l, r, i;
  bool operator<(query other) const {
    return make_pair(l / len, r) < make_pair(other.l / len, other.r);
  }
};
int main() {
  int n, m, i, k;
  cin >> n >> m >> k;
  a[0] = 0;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] ^= a[i - 1];
  }
  for (i = 1; i <= 1048576; i++) cnt[i] = 0;
  vector<query> q(m);
  vector<long long int> ans(m);
  for (i = 0; i < m; i++) {
    cin >> q[i].l >> q[i].r;
    q[i].l--;
    q[i].i = i;
  }
  sort(q.begin(), q.end());
  int L = 1, R = 0;
  long long int answer = 0;
  for (query q : q) {
    while (L < q.l) {
      cnt[a[L]]--;
      answer -= cnt[a[L] ^ k];
      L++;
    }
    while (L > q.l) {
      answer += cnt[a[L - 1] ^ k];
      L--;
      cnt[a[L]]++;
    }
    while (R > q.r) {
      cnt[a[R]]--;
      answer -= cnt[a[R] ^ k];
      R--;
    }
    while (R < q.r) {
      answer += cnt[a[R + 1] ^ k];
      R++;
      cnt[a[R]]++;
    }
    ans[q.i] = answer;
  }
  for (long long int u : ans) cout << u << endl;
}
