#include <bits/stdc++.h>
using namespace std;
int n, m, a[1000005], o[1000005], b[1000005], T, to[1000005], c[1000005], pos;
inline void read(int &x) {
  register int f = 1;
  x = 0;
  register char s = getchar();
  while (!isdigit(s)) {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (isdigit(s)) {
    x = x * 10 + s - '0';
    s = getchar();
  }
  x *= f;
}
struct Q {
  int l, r, op;
  bool operator<(const Q ot) const {
    if ((l - 1) / pos ^ (ot.l - 1) / pos) return l < ot.l;
    return (l - 1) / pos & 1 ? r < ot.r : r > ot.r;
  }
} q[1000005];
int ans, Ans[1000005];
inline void add(int x) {
  if (!c[to[x]]) ans ^= a[x];
  c[to[x]]++;
  ans ^= a[x];
}
inline void del(int x) {
  c[to[x]]--;
  ans ^= a[x];
  if (!c[to[x]]) ans ^= a[x];
}
int main() {
  read(n);
  pos = sqrt(n);
  for (register int i = 1; i <= n; i++) read(a[i]), o[i] = a[i];
  sort(o + 1, o + n + 1);
  for (register int i = 1; i <= n; i++)
    if (o[i] != o[i - 1]) b[++T] = o[i];
  for (register int i = 1; i <= n; i++)
    to[i] = lower_bound(b + 1, b + T + 1, a[i]) - b;
  read(m);
  for (register int i = 1; i <= m; i++) read(q[i].l), read(q[i].r), q[i].op = i;
  sort(q + 1, q + m + 1);
  register int l = 1, r = 1;
  c[to[1]] = 1;
  ans = 0;
  for (register int i = 1; i <= m; i++) {
    while (r < q[i].r) add(++r);
    while (r > q[i].r) del(r--);
    while (l < q[i].l) del(l++);
    while (l > q[i].l) add(--l);
    Ans[q[i].op] = ans;
  }
  for (int i = 1; i <= m; i++) printf("%d\n", Ans[i]);
  return 0;
}
