#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000010;
const int offset = (1 << 20);
struct tournament {
  int p[offset * 2];
  tournament() { memset(p, 0, sizeof p); }
  void update(int cvor, int l, int r, int a, int b, int x) {
    if (b < a) return;
    if (l > b || r < a) return;
    if (l >= a && r <= b) {
      p[cvor] ^= x;
      return;
    }
    int mid = (l + r) / 2;
    update(cvor * 2, l, mid, a, b, x);
    update(cvor * 2 + 1, mid + 1, r, a, b, x);
  }
  int get(int cvor) {
    cvor += offset;
    int ret = 0;
    while (cvor) {
      ret ^= p[cvor];
      cvor /= 2;
    }
    return ret;
  }
};
tournament T;
int n, m, gdje[MAXN], l, r, p[MAXN], pref[MAXN], sol[MAXN];
int p1[MAXN], koji[MAXN];
vector<pair<pair<int, int>, int> > v;
vector<int> v1;
int main() {
  scanf("%d", &n);
  for (int i = (0); i < int(n); i++) scanf("%d", &p[i]);
  memcpy(p1, p, sizeof p);
  for (int i = (0); i < int(n); i++) v1.push_back(p[i]);
  pref[0] = p[0];
  for (int i = (1); i < int(n); i++) pref[i] = pref[i - 1] ^ p[i];
  sort((v1).begin(), (v1).end());
  v1.erase(unique((v1).begin(), (v1).end()), v1.end());
  for (int i = (0); i < int(n); i++)
    p[i] = lower_bound((v1).begin(), (v1).end(), p[i]) - v1.begin();
  for (int i = (0); i < int(n); i++)
    v.push_back(make_pair(make_pair(i, i), -(i + 1)));
  scanf("%d", &m);
  for (int i = (0); i < int(m); i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    a--;
    b--;
    sol[i] = pref[b];
    if (a) sol[i] ^= pref[a - 1];
    v.push_back(make_pair(make_pair(a, -1), i));
    v.push_back(make_pair(make_pair(b, MAXN), i));
  }
  sort((v).begin(), (v).end());
  l = -1;
  for (int i = (0); i < int((int)v.size()); i++) {
    if (v[i].first.first == v[i].first.second) {
      if (l >= gdje[p[v[i].first.first]]) {
        T.update(1, 0, offset - 1, gdje[p[v[i].first.first]], l,
                 p1[v[i].first.first]);
        gdje[p[v[i].first.first]] = l + 1;
      }
      continue;
    }
    if (v[i].first.second == -1) {
      l++;
      koji[v[i].second] = l;
    }
    if (v[i].first.second == MAXN) sol[v[i].second] ^= T.get(koji[v[i].second]);
  }
  for (int i = (0); i < int(m); i++) printf("%d\n", sol[i]);
  return 0;
}
