{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eYou 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.\u003c/p\u003e\u003cp\u003eIn one operation, you can choose some index $$$i$$$ and \u003cspan class\u003d\"tex-font-style-bf\"\u003eremove\u003c/span\u003e the $$$i$$$-th character of $$$s$$$ ($$$s_i$$$) if \u003cspan class\u003d\"tex-font-style-bf\"\u003eat least one\u003c/span\u003e of its adjacent characters is the \u003cspan class\u003d\"tex-font-style-it\"\u003eprevious\u003c/span\u003e letter in the Latin alphabet for $$$s_i$$$. For example, the \u003cspan class\u003d\"tex-font-style-it\"\u003eprevious\u003c/span\u003e letter for \u003cspan class\u003d\"tex-font-style-tt\"\u003eb\u003c/span\u003e is \u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e, the \u003cspan class\u003d\"tex-font-style-it\"\u003eprevious\u003c/span\u003e letter for \u003cspan class\u003d\"tex-font-style-tt\"\u003es\u003c/span\u003e is \u003cspan class\u003d\"tex-font-style-tt\"\u003er\u003c/span\u003e, the letter \u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e has no \u003cspan class\u003d\"tex-font-style-it\"\u003eprevious\u003c/span\u003e 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.\u003c/p\u003e\u003cp\u003eFor 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| \u003d 1$$$).\u003c/p\u003e\u003cp\u003eConsider the following example. Let $$$s\u003d$$$ \u003cspan class\u003d\"tex-font-style-tt\"\u003ebacabcab\u003c/span\u003e.\u003c/p\u003e\u003col\u003e \u003cli\u003e During the first move, you can remove the first character $$$s_1\u003d$$$ \u003cspan class\u003d\"tex-font-style-tt\"\u003eb\u003c/span\u003e because $$$s_2\u003d$$$ \u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e. Then the string becomes $$$s\u003d$$$ \u003cspan class\u003d\"tex-font-style-tt\"\u003eacabcab\u003c/span\u003e. \u003c/li\u003e\u003cli\u003e During the second move, you can remove the fifth character $$$s_5\u003d$$$ \u003cspan class\u003d\"tex-font-style-tt\"\u003ec\u003c/span\u003e because $$$s_4\u003d$$$ \u003cspan class\u003d\"tex-font-style-tt\"\u003eb\u003c/span\u003e. Then the string becomes $$$s\u003d$$$ \u003cspan class\u003d\"tex-font-style-tt\"\u003eacabab\u003c/span\u003e. \u003c/li\u003e\u003cli\u003e During the third move, you can remove the sixth character $$$s_6\u003d$$$\u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003eb\u003c/span\u003e\u0027 because $$$s_5\u003d$$$ \u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e. Then the string becomes $$$s\u003d$$$ \u003cspan class\u003d\"tex-font-style-tt\"\u003eacaba\u003c/span\u003e. \u003c/li\u003e\u003cli\u003e During the fourth move, the only character you can remove is $$$s_4\u003d$$$ \u003cspan class\u003d\"tex-font-style-tt\"\u003eb\u003c/span\u003e, because $$$s_3\u003d$$$ \u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e (or $$$s_5\u003d$$$ \u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e). The string becomes $$$s\u003d$$$ \u003cspan class\u003d\"tex-font-style-tt\"\u003eacaa\u003c/span\u003e and you cannot do anything with it. \u003c/li\u003e\u003c/ol\u003e\u003cp\u003eYour task is to find the maximum possible number of characters you can remove if you choose the sequence of operations optimally.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line of the input contains one integer $$$|s|$$$ ($$$1 \\le |s| \\le 100$$$) — the length of $$$s$$$.\u003c/p\u003e\u003cp\u003eThe second line of the input contains one string $$$s$$$ consisting of $$$|s|$$$ lowercase Latin letters.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint one integer — the maximum possible number of characters you can remove if you choose the sequence of moves optimally.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e8\nbacabcab\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4\nbcda\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e6\nabbbbb\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e5\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eThe 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$$$.\u003c/p\u003e\u003cp\u003eIn the second example, you can remove all but one character of $$$s$$$. The only possible answer follows.\u003c/p\u003e\u003col\u003e \u003cli\u003e During the first move, remove the third character $$$s_3\u003d$$$ \u003cspan class\u003d\"tex-font-style-tt\"\u003ed\u003c/span\u003e, $$$s$$$ becomes \u003cspan class\u003d\"tex-font-style-tt\"\u003ebca\u003c/span\u003e. \u003c/li\u003e\u003cli\u003e During the second move, remove the second character $$$s_2\u003d$$$ \u003cspan class\u003d\"tex-font-style-tt\"\u003ec\u003c/span\u003e, $$$s$$$ becomes \u003cspan class\u003d\"tex-font-style-tt\"\u003eba\u003c/span\u003e. \u003c/li\u003e\u003cli\u003e And during the third move, remove the first character $$$s_1\u003d$$$ \u003cspan class\u003d\"tex-font-style-tt\"\u003eb\u003c/span\u003e, $$$s$$$ becomes \u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e. \u003c/li\u003e\u003c/ol\u003e"}}]}