#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
const int SQRT = 500;
vector<pair<int, int> > quer[SQRT];
int n, m, k;
int arr[MAXN];
int num[(1 << 20) + 5];
long long ans = 0;
map<pair<int, int>, long long> an;
bool cmp(pair<int, int> a, pair<int, int> b) { return a.second < b.second; }
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m >> k;
  for (int g = 1; g <= n; g++) cin >> arr[g];
  for (int g = 1; g <= n; g++) arr[g] = arr[g] ^ arr[g - 1];
  vector<pair<int, int> > qu;
  for (int g = 0; g < m; g++) {
    int a, b;
    cin >> a >> b;
    a--;
    qu.push_back(pair<int, int>(a, b));
    quer[a / SQRT].push_back(pair<int, int>(a, b));
  }
  for (int g = 0; g < SQRT; g++) {
    if (quer[g].size() == 0) continue;
    ans = 0;
    for (int y = 1; y <= n; y++) num[arr[y]] = 0;
    stable_sort(quer[g].begin(), quer[g].end(), cmp);
    int l = quer[g][0].first, r = quer[g][0].first;
    num[arr[l]]++;
    for (pair<int, int>& y : quer[g]) {
      for (int z = r + 1; z <= y.second; z++) {
        ans += num[arr[z] ^ k];
        num[arr[z]]++;
      }
      for (int z = l - 1; z >= y.first; z--) {
        ans += num[arr[z] ^ k];
        num[arr[z]]++;
      }
      for (int z = l; z < y.first; z++) {
        num[arr[z]]--;
        ans -= num[arr[z] ^ k];
      }
      for (int z = r; z > y.second; z--) {
        num[arr[z]]--;
        ans -= num[arr[z] ^ k];
      }
      an[pair<int, int>(y.first, y.second)] = ans;
      l = y.first, r = y.second;
    }
  }
  for (int t = 0; t < qu.size(); t++) cout << an[qu[t]] << '\n';
  return 0;
}
