#include <bits/stdc++.h>
using namespace std;
long long n, m, k, pref[100005], le, ri, ans, jaw[100005], bsr, cnt[1100005],
    dis, arr[100005];
pair<pair<long long, long long>, long long> q[100005];
vector<pair<pair<long long, long long>, long long> > mo[350];
bool cmp(pair<pair<long long, long long>, long long> a,
         pair<pair<long long, long long>, long long> b) {
  if (a.first.first / dis == b.first.first / dis)
    return a.first.second < b.first.second;
  return a.first.first / dis < b.first.first / dis;
}
void in(long long x) {
  ans += cnt[x ^ k];
  cnt[x]++;
}
void out(long long x) {
  cnt[x]--;
  ans -= cnt[x ^ k];
}
int main() {
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; i++) cin >> arr[i];
  for (long long i = 1; i <= m; i++) {
    cin >> q[i].first.first >> q[i].first.second;
    q[i].second = i;
  }
  dis = sqrt(n);
  sort(q + 1, q + m + 1, cmp);
  for (long long i = 1; i <= m; i++) {
    mo[q[i].first.first / dis].push_back(q[i]);
    bsr = q[i].first.first / dis;
  }
  for (long long i = 1; i <= n; i++) {
    pref[i] = arr[i] ^ pref[i - 1];
  }
  for (long long i = 0; i <= bsr; i++) {
    for (long long j = 0; j < mo[i].size(); j++) {
      if (j == 0) {
        for (long long p = mo[i][j].first.first - 1; p <= mo[i][j].first.second;
             p++) {
          in(pref[p]);
        }
        le = mo[i][j].first.first - 1;
        ri = mo[i][j].first.second;
      } else {
        while (ri < mo[i][j].first.second) {
          ri++;
          in(pref[ri]);
        }
        while (le < mo[i][j].first.first - 1) {
          out(pref[le]);
          le++;
        }
        while (le > mo[i][j].first.first - 1) {
          le--;
          in(pref[le]);
        }
      }
      jaw[mo[i][j].second] = ans;
    }
    for (long long j = le; j <= ri; j++) {
      out(pref[j]);
    }
  }
  for (long long i = 1; i <= m; i++) {
    cout << jaw[i] << endl;
  }
}
