#include <bits/stdc++.h>
using namespace std;
struct Query {
  int left;
  int right;
  int index;
  bool operator<(const Query &other) const { return right < other.right; }
};
const int N = 1e6 + 100;
int a[N];
int xorSum[N];
Query q[N];
int ans[N];
struct FenwickTree {
  FenwickTree() { fill(array, array + N, 0); }
  int lowbit(int a) { return a & -a; }
  void update(int i, int value) {
    while (i <= n) {
      array[i] ^= value;
      i += lowbit(i);
    }
  }
  int query(int i) {
    int res = 0;
    while (i > 0) {
      res ^= array[i];
      i -= lowbit(i);
    }
    return res;
  }
  int n;
  int array[N];
} tr;
int main() {
  int n, m, i, j;
  scanf("%d", &n);
  tr.n = n;
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  scanf("%d", &m);
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &q[i].left, &q[i].right);
    q[i].index = i;
  }
  sort(q + 1, q + 1 + m);
  map<int, int> last;
  for (i = 1, j = 1; i <= n; i++) {
    int &lastTmp = last[a[i]];
    if (lastTmp > 0) {
      tr.update(lastTmp, a[i]);
    }
    lastTmp = i;
    tr.update(i, a[i]);
    xorSum[i] = xorSum[i - 1] ^ a[i];
    for (; j <= m && q[j].right == i; j++) {
      ans[q[j].index] = xorSum[i] ^ xorSum[q[j].left - 1] ^
                        tr.query(q[j].right) ^ tr.query(q[j].left - 1);
    }
  }
  for (i = 1; i <= m; i++) {
    printf("%d\n", ans[i]);
  }
  return 0;
}
