Given an array a with n elements, you can perform the following operation an infinite number of times: Choose an index 1≤i≤n−1 such that ai=ai+1, delete the two elements ai and ai+1, and replace them with an element with the value ai+1. Find the minimum possible length of the array a.
Input:
7
3 3 4 4 4 3 3
Output:
2