Tile Laying
Renowned programmer Petryk is once again creating a new platformer-style computer game. In one of the levels, there is a corridor divided into N equal sections, which needs to be covered with tiles. Each tile can be of any length and can cover multiple consecutive sections. Your task is to arrange the tiles so that each section is covered by the specified number of tiles. Help Petryk determine the minimum number of tiles required for this task.
Input
The first line contains an integer N (1 ≤ N ≤ 200000), representing the length of the corridor. The second line contains N integers, each indicating the number of tiles that should cover the corresponding section. All numbers are non-negative and do not exceed 10^9.
Output
Output the minimum number of tiles needed to cover the corridor as specified.