#include <bits/stdc++.h>
using namespace std;
inline int readChar();
inline int readInt();
template <class T>
inline void writeInt(T x);
inline void writeChar(int x);
inline void writeWord(const char *s);
inline void flush();
static const int buf_size = 4096;
inline int getChar() {
  static char buf[buf_size];
  static int len = 0, pos = 0;
  if (pos == len) pos = 0, len = fread(buf, 1, buf_size, stdin);
  if (pos == len) return -1;
  return buf[pos++];
}
inline int readChar() {
  int c = getChar();
  while (c <= 32) c = getChar();
  return c;
}
inline int readInt() {
  int s = 1, c = readChar();
  int x = 0;
  if (c == '-') s = -1, c = getChar();
  while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getChar();
  return s == 1 ? x : -x;
}
using namespace std;
const int sz1 = 700, ma = 1024 * 1024;
int n;
int ans[ma], ak[ma], npos[ma], segtr[ma];
int ql[ma], qr[ma];
int qq[ma];
pair<int, int> a[ma];
int gc() {
  int k;
  scanf("%d", &k);
  return k;
}
void add(int first, int k) {
  while (first <= n) {
    segtr[first] ^= k;
    first = (first | (first + 1));
  }
}
int get_ans(int first) {
  int ans = 0;
  while (first > 0) {
    ans ^= segtr[first];
    first = (first & (first + 1)) - 1;
  }
  return ans;
}
int get_ans(int l, int r) { return (get_ans(l) ^ get_ans(r)); }
bool cmp(int a, int b) { return ql[a] < ql[b]; }
int main() {
  n = readInt();
  for (int i = 0; i < n; i++) {
    a[i].first = readInt();
    ak[i] = a[i].first;
    add(i + 1, a[i].first);
    a[i].second = i + 1;
  }
  sort(a, a + n);
  int k = 0;
  for (int i = 0; i < n + 1; i++) npos[i] = n + 1;
  for (int i = 0; i < n; i++) {
    if (i == 0 || a[i].first != a[i - 1].first) {
      add(a[i].second, a[i].first);
    }
    if (i && a[i].first == a[i - 1].first) npos[a[i - 1].second] = a[i].second;
  }
  int m = readInt();
  for (int i = 0; i < m; i++) {
    qq[i] = i;
    ql[i] = readInt(), qr[i] = readInt();
  }
  sort(qq, qq + m, cmp);
  int l = 1;
  for (int j = 0; j < m; j++) {
    int i = qq[j];
    while (l < ql[i]) {
      int num = npos[l], k = ak[l - 1];
      int nu = l;
      add(l, k);
      if (npos[l] <= n) add(npos[l], k);
      l++;
    }
    ans[i] = get_ans(ql[i] - 1, qr[i]);
  }
  for (int i = 0; i < m; i++) printf("%d\n", ans[i]);
  return 0;
}
