#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const int INF = 2000000000;
const long long LINF = 2000000000000000000;
template <typename T>
void print(vector<T>& a) {
  for (int i = 0; i < a.size(); i++) cout << a[i] << ' ';
  cout << '\n';
}
template <typename T>
void print(deque<T>& a) {
  for (int i = 0; i < a.size(); i++) cout << a[i] << ' ';
  cout << '\n';
}
template <typename T>
void print(vector<vector<T>>& a) {
  for (int i = 0; i < a.size(); i++) {
    for (int j = 0; j < a[i].size(); j++) cout << a[i][j] << ' ';
    cout << '\n';
  }
}
template <typename T>
void input(vector<T>& a) {
  for (int i = 0; i < a.size(); i++) cin >> a[i];
}
template <typename T>
void input(deque<T>& a) {
  for (int i = 0; i < a.size(); i++) cin >> a[i];
}
template <typename T>
void input(vector<vector<T>>& a) {
  for (int i = 0; i < a.size(); i++)
    for (int j = 0; j < a[i].size(); j++) cin >> a[i][j];
}
long long n, m, k;
vector<long long> a;
vector<long long> cnt;
long long answer = 0;
int K;
int l = 1, r = 0;
struct query {
  int l, r;
  int idx;
};
bool cmp(query a, query b) {
  return a.l / K < b.l / K || a.l / K == b.l / K && a.r < b.r;
}
void add(int i) {
  answer += cnt[a[i] ^ k];
  cnt[a[i]]++;
}
void del(int i) {
  cnt[a[i]]--;
  answer -= cnt[a[i] ^ k];
}
void solve() {
  cin >> n >> m >> k;
  a = vector<long long>(n + 1);
  cnt = vector<long long>(2000000);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] = a[i - 1] ^ a[i];
  }
  K = sqrt(n);
  vector<query> q(m);
  for (int i = 0; i < m; i++) cin >> q[i].l >> q[i].r, q[i].idx = i, q[i].l--;
  sort((q).begin(), (q).end(), cmp);
  vector<long long> ans(m);
  for (auto to : q) {
    while (l > to.l) add(--l);
    while (r < to.r) add(++r);
    while (l < to.l) del(l++);
    while (r > to.r) del(r--);
    ans[to.idx] = answer;
  }
  for (auto to : ans) cout << to << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tst = 1;
  while (tst--) {
    solve();
  }
}
