{"raw_statement":[{"iden":"problem statement","content":"In a flower bed, there are $N$ flowers, numbered $1,2,......,N$. Initially, the heights of all flowers are $0$. You are given a sequence $h={h_1,h_2,h_3,......}$ as input. You would like to change the height of Flower $k$ to $h_k$ for all $k$ $(1 \\leq k \\leq N)$, by repeating the following \"watering\" operation:\n\n*   Specify integers $l$ and $r$. Increase the height of Flower $x$ by $1$ for all $x$ such that $l \\leq x \\leq r$.\n\nFind the minimum number of watering operations required to satisfy the condition."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 100$\n*   $0 \\leq h_i \\leq 100$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$h_1$ $h_2$ $h_3$ $......$ $h_N$"},{"iden":"sample input 1","content":"4\n1 2 2 1"},{"iden":"sample output 1","content":"2\n\nThe minimum number of watering operations required is $2$. One way to achieve it is:\n\n*   Perform the operation with $(l,r)=(1,3)$.\n*   Perform the operation with $(l,r)=(2,4)$."},{"iden":"sample input 2","content":"5\n3 1 2 3 1"},{"iden":"sample output 2","content":"5"},{"iden":"sample input 3","content":"8\n4 23 75 0 23 96 50 100"},{"iden":"sample output 3","content":"221"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}