#P1132F. Clear the String

Clear the String

Description

You are given a string ss of length nn consisting of lowercase Latin letters. You may apply some operations to this string: in one operation you can delete some contiguous substring of this string, if all letters in the substring you delete are equal. For example, after deleting substring bbbb from string abbbbaccdd we get the string aaccdd.

Calculate the minimum number of operations to delete the whole string ss.

The first line contains one integer nn (1n5001 \le n \le 500) — the length of string ss.

The second line contains the string ss (s=n|s| = n) consisting of lowercase Latin letters.

Output a single integer — the minimal number of operation to delete string ss.

Input

The first line contains one integer nn (1n5001 \le n \le 500) — the length of string ss.

The second line contains the string ss (s=n|s| = n) consisting of lowercase Latin letters.

Output

Output a single integer — the minimal number of operation to delete string ss.

Sample Input 1

5
abaca

Sample Output 1

3

Sample Input 2

8
abcddcba

Sample Output 2

4