You are given an array A containing N integers. You have to answer Q queries.
Queries are of form:
L R
Here you have to fInd sum of all numbers Ai, for those Ai which has odd frequency in subarray L to R
INPUT CONSTRAINTS
INPUT FORMAT
First line of input contains a single integer N, next line contains N space separated integers, elements of array A. Next line of input contains a single integer Q. Q lines follow each containing two space separated integer L and R.
OUTPUT Fvv
For each query, print the answer to the query in new line.
Hint:
Mo's Algorithm
For query 1: 1 has frequency 1 and 2 has frequency 2 so, answer is 1
For query 2: 1 has frequency 1 and 2 has frequency 3 So, answer is 7