#include <bits/stdc++.h>
using namespace std;
const int maxx = 1ll << 20;
int pos[maxx];
long long ans[maxx], flag[maxx], a[maxx];
int n, m, k;
struct S {
  int l, r, id;
  bool operator<(const S& a) const {
    if (pos[l] == pos[a.l]) return r < a.r;
    return pos[l] < pos[a.l];
  }
};
int L = 1, R = 0;
long long Ans = 0;
S q[maxx];
void add(int x) {
  Ans += flag[a[x] ^ k];
  flag[a[x]]++;
}
void del(int x) {
  flag[a[x]]--;
  Ans -= flag[a[x] ^ k];
}
int main() {
  cin >> n >> m >> k;
  int sz = sqrt(n);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] = a[i] ^ a[i - 1];
    pos[i] = i / sz;
  }
  for (int i = 1; i <= m; i++) {
    cin >> q[i].l >> q[i].r;
    q[i].id = i;
  }
  sort(q + 1, q + 1 + m);
  flag[0] = 1;
  for (int i = 1; i <= m; i++) {
    while (L < q[i].l) {
      del(L - 1);
      L++;
    }
    while (L > q[i].l) {
      L--;
      add(L - 1);
    }
    while (R > q[i].r) {
      del(R);
      R--;
    }
    while (R < q[i].r) {
      R++;
      add(R);
    }
    ans[q[i].id] = Ans;
  }
  for (int i = 1; i <= m; i++) cout << ans[i] << endl;
  return 0;
}
