G. Youngling Tournament
time limit per test
2 seconds
memory limit per test
256 mebibytes
input
standard input
output
standard output

Yoda, the Grand Master of the Jedi Order, hit on the idea to hold a tournament among younglings. He has not chosen the date yet, but he has already decided on the format of the tournament.

There are N younglings studying in the Jedi Temple. Yoda can feel the Force inside younglings, moreover, he can represent the amount of the Force inside i-th youngling as the number fi.

Therefore, the format of the tournament is the following. At first, Yoda makes the children stand in a row in order of non-increasing fi. Then, the first youngling in the row competes against all the others united together. The combat is based on lightsaber battle and is very spectacular. However, Yoda knows that the result doesn't depend on anything but the Force inside competitors. The youngling wins if his amount of Force is not less than the total amount of the Force inside all his opponents. In that case, he is considered one of the winners. Otherwise, he loses. Anyway, after that he is removed from the row, and the tournament continues. Again, the strongest (first in the row) youngling competes against all the others standing in the row in the same format, if he wins, he is also considered one of the winners. After that he is removed and the tournament continues in the same format until there is only one child in the row. He becomes one of the winners automatically and the tournament finishes.

Yoda wants to know the total number of winners. However, as the tournament is postponed again and again, the amount of the Force inside the younglings changes from time to time. Help Yoda to compute the total number of winners after each change.

Input

The first line of input contains a single integer N, the number of younglings in the Jedi Temple (1 ≤ N ≤ 100 000).

The second line contains N integers f1, f2, ..., fN the amount of the Force inside the younglings (1 ≤ fi ≤ 1012).

The third line of the input contains a single integer M, the number of changes in the Force amounts of students (0 ≤ M ≤ 50 000).

The next M lines contain information about the changes. The i-th of these lines describes the i-th change and contains two integers k and fk * , which mean that the amount of the Force inside the k-th youngling becomes equal to fk *  (1 ≤ k ≤ N, 1 ≤ fk *  ≤ 1012).

Output

Print M + 1 lines, each of them containing a single integer.

On the first line, print the number of winners if the tournament was held before all the changes. On line (i + 1) for all i > 0, print the number of winners if the tournament was held after the first i changes.

Examples
Input
3
2 1 3
3
1 3
2 7
3 5
Output
3
2
3
2
Input
7
2 14 14 15 5 2 5
5
5 2
4 12
5 4
3 10
7 9
Output
4
3
3
3
3
4