#include <bits/stdc++.h>
using namespace std;
int min(int a, int b) {
  if (a < b) return a;
  return b;
}
double min(double a, double b) {
  if (a < b) return a;
  return b;
}
int max(int a, int b) {
  if (a > b) return a;
  return b;
}
int ABS(int a) {
  if (a < 0) return -a;
  return a;
}
int parent[100004], h[100005];
void make_set(int v) { parent[v] = v; }
int find_set(int v) {
  if (v == parent[v]) return v;
  return parent[v] = find_set(parent[v]);
}
void union_sets(int a, int b) {
  a = find_set(a);
  b = find_set(b);
  if (a != b) {
    if (h[a] > h[b]) swap(a, b);
    parent[b] = a;
  }
}
pair<int, int> getCharHash(int p1, int p2, char c) {
  return make_pair(p1 * (c - 'a'), p2 * (c - 'a'));
}
vector<pair<int, int> > p;
int double_area(int x1, int y1, int x2, int y2, int x3, int y3) {
  return (x1 - x2) * (y2 + y1) + (x2 - x3) * (y3 + y2) + (x3 - x1) * (y1 + y3);
}
int tree[4000000];
int c[1000004];
int pref_xors[1000004];
int next_pos[1000004];
int pref_unique_xors[1000006];
map<int, int> M;
set<int> uniques;
vector<pair<pair<int, int>, int> > q;
vector<pair<int, int> > ans;
int suf_sum(int l, int r, int nl, int nr, int node) {
  if (l == nl && r == nr) {
    return tree[node];
  }
  int m = (nr + nl) / 2;
  if (r <= m) {
    return suf_sum(l, r, nl, m, node * 2);
  }
  if (l > m) {
    return suf_sum(l, r, m + 1, nr, node * 2 + 1);
  }
  return suf_sum(l, m, nl, m, node * 2) ^
         suf_sum(m + 1, r, m + 1, nr, node * 2 + 1);
}
void update(int l, int r, int node, int pos, int value) {
  if (l == r) {
    tree[node] ^= value;
    return;
  }
  int m = (l + r) / 2;
  if (pos <= m) {
    update(l, m, node * 2, pos, value);
  } else {
    update(m + 1, r, node * 2 + 1, pos, value);
  }
  tree[node] = tree[node * 2] ^ tree[node * 2 + 1];
  return;
}
int XOR(int i, int j) {
  if (i == 0) {
    return pref_xors[j];
  }
  return pref_xors[j] ^ pref_xors[i - 1];
}
int main() {
  int n;
  int p = 1;
  scanf("%d", &n);
  while (p <= n) p *= 2;
  for (int i = 0; i < n; ++i) {
    scanf("%d", c + i);
    if (i == 0)
      pref_xors[0] = c[0];
    else
      pref_xors[i] = pref_xors[i - 1] ^ c[i];
  }
  for (int i = n - 1; i >= 0; --i) {
    if (M[c[i]]) {
      next_pos[i] = M[c[i]];
    } else {
      next_pos[i] = n;
    }
    M[c[i]] = i;
  }
  int m;
  scanf("%d", &m);
  int a, b;
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &a, &b);
    a--;
    b--;
    q.push_back(make_pair(make_pair(a, b), i));
  }
  sort(q.begin(), q.end());
  for (int i = q[0].first.first; i < n; ++i) {
    if (i == 0) {
      pref_unique_xors[0] = c[0];
      uniques.insert(c[0]);
    } else {
      if (uniques.find(c[i]) != uniques.end()) {
        pref_unique_xors[i] = pref_unique_xors[i - 1];
      } else {
        pref_unique_xors[i] = pref_unique_xors[i - 1] ^ c[i];
        uniques.insert(c[i]);
      }
    }
  }
  int j = q[0].first.first;
  for (int i = 0; i < m; ++i) {
    a = q[i].first.first;
    b = q[i].first.second;
    if (a != j) {
      for (int k = j; k < a; ++k) {
        update(0, p - 1, 1, next_pos[k], c[k]);
      }
      j = a;
    }
    int answer =
        XOR(a, b) ^ pref_unique_xors[b] ^ suf_sum(b + 1, p - 1, 0, p - 1, 1);
    ans.push_back(make_pair(q[i].second, answer));
  }
  sort(ans.begin(), ans.end());
  for (int i = 0; i < m; ++i) {
    printf("%d\n", ans[i].second);
  }
  return 0;
}
