Renowned programmer Petryk has started developing a new platformer-style computer game. In one of the levels, there is a corridor divided into equal sections. The corridor must be covered with tiles. Each tile can have any length and can cover several consecutive sections. You must arrange the tiles so that each section is covered by the specified number of tiles. Help Petryk determine the minimum number of tiles needed for this.
The first line contains an integer (1 \leq N \leq 200000), which is the length of the corridor. The second line contains integers, each representing the number of tiles that must cover the corresponding section. All numbers are non-negative and do not exceed 10^9.
Output the minimum number of tiles required for the tiling.
Example 1