Columns#10281

Columns

1 second
128 megabytes
Medium

Given columns of cubes, the -th has height a_i. Find the smallest number of colors sufficient to color all the cubes so that all substrings and columns have different colors. Note that a substring is a horizontal sequence of cubes in a row, that is, without gaps.

Input

The first line contains one integer (1\leq n\leq 1000) — the number of columns.

The second line contains integers a_1, a_2, \dots, a_n (1\leq a_i\leq 1000) — the height of the -th column.

Output

Print one number — the minimum number of colors required to paint all cubes so that all substrings and columns have different colors.

Examples

Example 1

Loading
Loading

Note

One of the possible solutions:

Note that the third row from the bottom can have two identical colors if there is an empty space between them (the height of the third column is ).