Sahur has taken up gardening, and it's time for his annual checkup on one of the hedges he is maintaining. The hedge is represented as a series of segments of greenery of varying heights, represented by an array of $$$n$$$ integers. To clean up the hedge, he needs to trim it so that every part of the hedge is the same height (he is fine with any height; he just wants it to be uniform).
To do this, he can use some of the strange-looking razors that he bought at a yard sale. Each razor is much longer than the hedge and has cutting blades that are one segment wide and evenly spaced apart on the razor. For every positive integer $$$k$$$, he has a razor with $$$k$$$ segments of free space between each blade on the razor. In one application of a razor, he can line up the blades with some segments of the hedge, lift the razor to a certain height, and cut the hedge. A cut is applied simultaneously to all hedge segments that line up with the razor blades. If the hedge segment is taller than the blade, it will get cut down to the blade's height. Otherwise, the segment will not be cut. Since Sahur is lazy, he wants to minimize the number of times he has to use a razor to cut the hedge to his specifications.
The first line of input consists of one integer $$$n$$$ $$$(1 \le n \le 10^6)$$$, the size of the array.
The second line of input consists of $$$n$$$ integers $$$h_1,h_2,...,h_n$$$ $$$(1 \le h_i \le 10^6)$$$ — the heights of the segments of the hedge.
Output a single integer — the minimum number of times Sahur needs to use a razor to cut the hedge.
51 1 1 1 1
0
35 6 7
2
| Name |
|---|


