文理学院程序设计在线练习


BugZhu and BigBao

Time Limit: 1 Second(s)    Memory Limit: 128 MB

Total Submission(s): 4   Accepted Submission(s): 1
Problem Description

BugZhu and BigBao went to a mountainous area on the outskirts of Hangzhou city to visit a happy Valentine's day. But due to unforeseen circumstances, They got separated in the mountains. BugZhu and BigBao knew each other's location after they get in touch with their cell phone. Now BugZhu decided to go straight to the BigBao position. when they contacted, their smart phones reported the height of All mountains On the straight line between them. Unfortunately, in the mountains there were a group of boring spirits. They loved changing the height of the ground, and wanted to make some trouble for BugZhu, so they would increase the height of a certain area. After each change smart phone would report The number of hills On BugZhu's way. Now, help smart phones finish the job!
Note: 1 2 2 1 and 1 2 are not considered to be a hill.

Input

No more than 100 sets of data.
A number n (2 <= n <= 10000) indicates the horizontal distance between BugZhu and BigBao. The next line of n integers represents the height hi (hi <= 1e9) per meter of ground from BugZhu to BigBao.
A number q (n <= 1000) indicates the number of changes. The next q lines, each line has three integers l, r, a represents the ground [l, r] are increased by a (1 <= l <= r <= n, a <= 1e9).

Output

After each change, output a number that represents the number of hills.

Sample Input
2
1 2
1
2 2 1
3
1 1 1
1
2 2 1
Sample Output
0
1
Hint

1 2 2 1 and 1 2 are not considered to be a hill.

Source

2017绍兴市技能竞赛