#include <bits/stdc++.h>
using namespace std;
long long n, m, k, a[100010], kol[2000005], anser;
bool cmp(pair<pair<long long, long long>, long long> x,
         pair<pair<long long, long long>, long long> y) {
  long long lx = x.first.first / 316;
  long long ly = y.first.first / 316;
  if (lx != ly) return lx < ly;
  if (lx & 1) return x.first.second > y.first.second;
  return x.first.second < y.first.second;
}
void add(long long pos) {
  long long x = a[pos];
  anser += kol[x ^ k];
  kol[x]++;
}
void del(long long pos) {
  long long x = a[pos];
  kol[x]--;
  anser -= kol[x ^ k];
}
int main() {
  ios_base::sync_with_stdio(0);
  istream::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    if (i == 0)
      a[i] = x;
    else
      a[i] = a[i - 1] ^ x;
  }
  vector<pair<pair<long long, long long>, long long> > g;
  g.clear();
  for (long long j = 0; j < m; j++) {
    long long l, r;
    cin >> l >> r;
    l--;
    g.push_back({{l, r}, j});
  }
  sort(g.begin(), g.end(), cmp);
  long long l = 0, r = -1, ans[m];
  for (long long i = 0; i < m; i++) {
    long long L = g[i].first.first, R = g[i].first.second, nm = g[i].second;
    while (l < L) {
      del(l);
      l++;
    }
    while (r < R) {
      r++;
      add(r);
    }
    while (l > L) {
      l--;
      add(l);
    }
    while (r > R) {
      del(r);
      r--;
    }
    ans[nm] = anser;
  }
  for (long long i = 0; i < m; i++) cout << ans[i] << endl;
}
