One Extra Bead

You have a straight string of NN colored beads. Initially, no two neighboring beads have the same color.

You must insert exactly one new bead, of any uppercase-letter color, anywhere in the string, including at either end.

Whenever two neighboring beads have the same color, they disappear. The remaining parts join together, possibly causing another pair to disappear. This continues until no neighboring beads match.

What is the maximum number of original beads you can make disappear? Do not count the bead you inserted.

Input

The first line contains NN.

The second line contains NN uppercase English letters representing the bead colors.

Output

Print the maximum number of original beads that can disappear.

Constraints

Notes

In Sample 1, insert C next to the central C. The two Cs disappear, then the two inner As, then the Bs, then the outer As. All seven original beads disappear.

In Sample 2, you can remove one original bead by inserting a matching bead beside it, but no longer chain reaction is possible.

Sample Input 1 Sample Output 1
7
ABACABA
7
Sample Input 2 Sample Output 2
4
ABCD
1