Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

C. Remove Adjacent

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou are given a string $$$s$$$ consisting of lowercase Latin letters. Let the length of $$$s$$$ be $$$|s|$$$. You may perform several operations on this string.

In one operation, you can choose some index $$$i$$$ and remove the $$$i$$$-th character of $$$s$$$ ($$$s_i$$$) if at least one of its adjacent characters is the previous letter in the Latin alphabet for $$$s_i$$$. For example, the previous letter for b is a, the previous letter for s is r, the letter a has no previous letters. Note that after each removal the length of the string decreases by one. So, the index $$$i$$$ should satisfy the condition $$$1 \le i \le |s|$$$ during each operation.

For the character $$$s_i$$$ adjacent characters are $$$s_{i-1}$$$ and $$$s_{i+1}$$$. The first and the last characters of $$$s$$$ both have only one adjacent character (unless $$$|s| = 1$$$).

Consider the following example. Let $$$s=$$$ bacabcab.

- During the first move, you can remove the first character $$$s_1=$$$ b because $$$s_2=$$$ a. Then the string becomes $$$s=$$$ acabcab.
- During the second move, you can remove the fifth character $$$s_5=$$$ c because $$$s_4=$$$ b. Then the string becomes $$$s=$$$ acabab.
- During the third move, you can remove the sixth character $$$s_6=$$$'b' because $$$s_5=$$$ a. Then the string becomes $$$s=$$$ acaba.
- During the fourth move, the only character you can remove is $$$s_4=$$$ b, because $$$s_3=$$$ a (or $$$s_5=$$$ a). The string becomes $$$s=$$$ acaa and you cannot do anything with it.

Your task is to find the maximum possible number of characters you can remove if you choose the sequence of operations optimally.

Input

The first line of the input contains one integer $$$|s|$$$ ($$$1 \le |s| \le 100$$$) — the length of $$$s$$$.

The second line of the input contains one string $$$s$$$ consisting of $$$|s|$$$ lowercase Latin letters.

Output

Print one integer — the maximum possible number of characters you can remove if you choose the sequence of moves optimally.

Examples

Input

8 bacabcab

Output

4

Input

4 bcda

Output

3

Input

6 abbbbb

Output

5

Note

The first example is described in the problem statement. Note that the sequence of moves provided in the statement is not the only, but it can be shown that the maximum possible answer to this test is $$$4$$$.

In the second example, you can remove all but one character of $$$s$$$. The only possible answer follows.

- During the first move, remove the third character $$$s_3=$$$ d, $$$s$$$ becomes bca.
- During the second move, remove the second character $$$s_2=$$$ c, $$$s$$$ becomes ba.
- And during the third move, remove the first character $$$s_1=$$$ b, $$$s$$$ becomes a.

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jun/06/2020 11:59:03 (f1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|