dfs-2_36820
You have some boxes. All of them are assigned a unique positive integer. This number is written on them with a marker. Your task is simple that is to evaluate a number of queries. The description of a single query is 
given below:
The query consists of 2 positive integers L and R. 
You have to report total number of boxes that have the values in the range L and R (inclusive of L and R), written on them.

INPUT 
The first line of input contains a positive integer n, denoting the number of boxes.
The second line contains n space separated integers denoting the positive integer assigned to each box.  (p[1] .... p[n])
The third line contains an integer q, the number of queries.
After this q lines follow, each containing two positive integers L and R, as stated above, for this particular query.

OUTPUT
The output contains q lines. Each line contains a positive integer, the answer for that particular test case.

CONSTRAINTS
1 ≤ n ≤ 100000
1 ≤ p[i] ≤ 10^9
1 ≤ q ≤ 100000

SAMPLE INPUT
5
4 3 2 1 1
4
1 2
2 3
5 6
1 1

SAMPLE OUTPUT
3
2
0
2
import bisect;
N=input();  A=map(int,raw_input().split());	A.sort();
for _ in xrange(int(raw_input())):
	L,R=map(int,raw_input().split());
	print bisect.bisect_right(A,R) - bisect.bisect_left(A,L)
5
4 3 2 1 1
4
1 2
2 3
5 6
1 1

SAMPLE 5
4 3 2 1 1
4
1 2
2 3
5 6
1 1

MASPLE 5
4 3 1 1 1
4
1 2
2 3
5 6
1 1

MASPLE 5
3 3 2 1 1
4
1 2
2 3
5 6
1 1

SAMPLE 5
3 3 2 1 1
4
2 2
2 3
5 6
1 1

SAMPLE 5
4 3 2 1 1
4
1 2
1 3
5 6
1 1

MASPLF 5
4 3 2 1 1
4
1 2
1 3
5 8
1 2

MASPLF 5
1 3 2 1 1
4
1 2
1 3
5 8
1 2

MASPLF 5
1 3 2 1 1
4
1 1
1 3
5 8
1 2

MASPLF 5
2 3 2 1 1
4
0 1
1 3
5 8
1 2

MASPLF 5
4 3 2 1 1
4
0 1
1 3
5 8
0 2

MASPLF 5
4 5 2 1 1
4
0 1
1 3
5 8
0 2

MASPLF 5
4 4 2 1 1
4
1 2
2 3
5 6
1 1

MASPLE 5
6 3 1 1 1
4
1 2
2 3
5 6
1 1

MATPLE 5
3 3 2 1 1
4
1 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