Given a sequence $$$A$$$ consisting of $$$N$$$ integers.
In one operation, you can select a contiguous subsequence $$$A_i A_{i+1} \dots A_j$$$ ($$$i \le j$$$) that consists of the same element and increase all its elements by $$$1$$$. Your task is to equalize all elements of the sequence with the minimum number of operations.
The first line contains the length of the sequence $$$N$$$ ($$$1 \le N \le 10^5$$$).
The second line contains the elements of the sequence $$$A$$$ ($$$0 \le A_i \le 10^9$$$).
Output the minimum number of operations required to equalize all elements of the sequence.
4 3 1 2 4
3
Consider the example for the problem:
In the first operation, we increase the second element, resulting in $$$(3; 2; 2; 4)$$$. In the second operation, we increase the elements from the second to the third, resulting in $$$(3; 3; 3; 4)$$$. In the third operation, we increase the elements from the first to the third, resulting in $$$(4; 4; 4; 4)$$$.
| Name |
|---|


