#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int arr = 2e5 + 10;
const int ar = 2e3 + 10;
const long double pi = acos(-1);
const long double eps = 1e-10;
const long long md = 1e9 + 7;
const int bsize = 500;
vector<int> vh[(int)(2e6 + 10)];
int a[(int)(2e6 + 10)];
int pref[(int)(2e6 + 10)];
long long ans[(int)(2e6 + 10)];
vector<pair<pair<int, int>, int>> q;
int n, m, k;
bool cmp(const pair<pair<int, int>, int>& lhs,
         const pair<pair<int, int>, int>& rhs) {
  return lhs.first.first / bsize < rhs.first.first / bsize ||
         (lhs.first.first / bsize == rhs.first.first / bsize &&
          lhs.first.second < rhs.first.second);
}
int get(int val, int l, int r) {
  return upper_bound(vh[val].begin(), vh[val].end(), r) -
         lower_bound(vh[val].begin(), vh[val].end(), l);
}
void do_sqrt() {
  sort(q.begin(), q.end(), cmp);
  int l = 1, r = 1;
  long long cur_ans = 0;
  for (auto i : q) {
    while (l > i.first.first) {
      l--;
      cur_ans += get(pref[l - 1] ^ k, l, r - 1);
    }
    while (r <= i.first.second) {
      cur_ans += get(pref[r] ^ k, l - 1, r - 1);
      r++;
    }
    while (l < i.first.first) {
      cur_ans -= get(pref[l - 1] ^ k, l, r - 1);
      l++;
    }
    while (r > i.first.second + 1) {
      r--;
      cur_ans -= get(pref[r] ^ k, l - 1, r - 1);
    }
    ans[i.second] = cur_ans;
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m >> k;
  vh[0].push_back(0);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    pref[i] = pref[i - 1] ^ a[i];
    vh[pref[i]].push_back(i);
  }
  for (int i = 1; i <= m; i++) {
    int l, r;
    cin >> l >> r;
    q.push_back(make_pair(make_pair(l, r), i));
  }
  do_sqrt();
  for (int i = 1; i <= m; i++) {
    cout << ans[i] << "\n";
  }
}
