Problem H
Range Editing
You are editing a list of spreadsheet cells. Initially all cells are empty. You can perform two types of operations:
-
Select a consecutive range of cells and change their values to a positive integer of your choice. All these cells get the same value after this operation.
-
Select a consecutive range of cells and delete their values. All these cells become empty after this operation.
Given the final cell values that you would like to have in the spreadsheet, calculate the minimum number of editing operations required to obtain those values.
Input
The first line of input contains a single integer
Each of the next
Output
Output a single integer, which the minimum number of editing operations required.
Sample Input 1 | Sample Output 1 |
---|---|
10 0 1 2 3 4 2 1 0 0 1 |
5 |