#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
long long max(long long a, long long b) {
  if (a > b)
    return a;
  else
    return b;
}
long long min(long long a, long long b) {
  if (a > b)
    return b;
  else
    return a;
}
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline long long normalize(long long x, long long mod) {
  x %= mod;
  if (x < 0) x += mod;
  return x;
}
const long long mod = 1000 * 1000 * 1000 + 7;
const long long INF = 1e18 + 5;
long long powm(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
const long long N = 2e5 + 5;
long long n, q, a[N], k;
long long pref[N];
const long long Q = 2e5 + 5;
const long long M = 3e6 + 5;
const long long SZ = sqrt(N) + 1;
struct data {
  long long l, r, idx;
} qr[Q];
long long freq[M];
long long ans[Q];
long long cur = 0;
bool comp(struct data &d1, struct data &d2) {
  long long b1 = d1.l / SZ;
  long long b2 = d2.l / SZ;
  if (b1 != b2)
    return b1 < b2;
  else
    return (b1 & 1) ? d1.r < d2.r : d1.r > d2.r;
}
inline void add(long long x) {
  cur += freq[k ^ x];
  freq[x] += 1;
}
inline void remove(long long x) {
  freq[x]--;
  cur -= freq[k ^ x];
}
void mo() {
  sort(qr + 1, qr + q + 1, comp);
  long long l = 1, r = 0;
  cur = 0;
  for (long long i = 1; i <= q; i++) {
    while (r < qr[i].r) add(pref[++r]);
    while (r > qr[i].r) remove(pref[r--]);
    while (l < qr[i].l) remove(pref[l++]);
    while (l > qr[i].l) add(pref[--l]);
    ans[qr[i].idx] = cur;
  }
}
void solve() {
  cin >> n >> q >> k;
  for (long long i = (1); i < (n + 1); ++i) {
    cin >> a[i];
    pref[i] = pref[i - 1] ^ a[i];
  }
  for (long long i = 1; i <= q; ++i) {
    cin >> qr[i].l >> qr[i].r;
    --qr[i].l;
    qr[i].idx = i;
  }
  mo();
  for (long long i = 1; i <= q; i++) cout << ans[i] << "\n";
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
