#include <bits/stdc++.h>
long long INF = 1e9;
long long LINF = INF * INF;
long long mod = 1000000007;
using namespace std;
const long double EPS = 0.00000001;
int n, m, k;
int block = 1;
long long mas[200007];
long long cnt[4000007];
map<pair<int, int>, long long> res;
vector<pair<int, int> > qs[1000];
vector<pair<int, int> > ans;
bool comp(pair<int, int> a, pair<int, int> b) { return a.second < b.second; }
long long add(int p) {
  int res = cnt[mas[p] ^ k];
  cnt[mas[p]]++;
  return res;
}
long long del(int p) {
  cnt[mas[p]]--;
  return -cnt[mas[p] ^ k];
}
void make(int b) {
  long long cur = 0;
  int cl = b * block;
  int cr = b * block - 1;
  if (qs[b].size() > 0) {
    cl = qs[b][0].first;
    cr = qs[b][0].first - 1;
  }
  for (int i = 0; i < qs[b].size(); i++) {
    pair<int, int> c = qs[b][i];
    while (cr < c.second) {
      cur += add(++cr);
    }
    while (cl < c.first) {
      cur += del(cl++);
    }
    while (cl > c.first) {
      cur += add(--cl);
    }
    res[c] = cur;
  }
  while (cr >= cl) del(cr--);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> k;
  while (block * block < n) block++;
  for (int i = 1; i <= n; i++) {
    cin >> mas[i];
  }
  for (int i = 2; i <= n; i++) {
    mas[i] = mas[i] ^ mas[i - 1];
  }
  int a, b;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    a--;
    qs[a / block].push_back(make_pair(a, b));
    ans.push_back(make_pair(a, b));
  }
  for (int i = 0; i <= block; i++) {
    sort(qs[i].begin(), qs[i].end(), comp);
    make(i);
  }
  for (int i = 0; i < m; i++) {
    cout << res[ans[i]] << endl;
  }
  return 0;
}
