{"trustable":false,"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":"MD","content":"\nPLUR is a well-known motto at electronic music festivals that stands for \"Peace Love Unity Respect\". All people who believe in PLUR should wear very colorful *kandies* to distribute PLUR throughout the festival.\n\nYour friend Santirax is going to EDC for the first time and wants to bring the most colorful *kandies* from the entire festival, but he have a problem: He only has red, green and blue bead. You as his friend, will help him to create the most colorful kandie as possible.\n\nSantirax will give you N beads in a certain order and asked you not to change that order. You can only remove beads to make a colorful kandie. A kandie is colorful if for any bead, its adjacent beads are of a different color.\n\nSince the kandies go on the wrist of your hand, you want the bracelet to be as long as possible, therefore you will have to remove as few beads as possible to make a colorful kandie."}},{"title":"Input","value":{"format":"MD","content":"The first line contains integer \u003cimg src\u003d\"https://render.githubusercontent.com/render/math?math\u003dN(1\\leq%20N\\leq50)\"\u003e — the number of beads on the table.\nThe next line contains string \u003cimg src\u003d\"https://render.githubusercontent.com/render/math?math\u003dS\"\u003e, which represents the colors of the beads. We\u0027ll consider the beads in the row numbered from \u003cimg src\u003d\"https://render.githubusercontent.com/render/math?math\u003d1\"\u003e to \u003cimg src\u003d\"https://render.githubusercontent.com/render/math?math\u003dN\"\u003e from left to right. Then the \u003cimg src\u003d\"https://render.githubusercontent.com/render/math?math\u003di^{th}\"\u003e character \u003cimg src\u003d\"https://render.githubusercontent.com/render/math?math\u003dS\"\u003e equals \"R\", if the \u003cimg src\u003d\"https://render.githubusercontent.com/render/math?math\u003di^{th}\"\u003e bead is red, \"G\", if it\u0027s green and \"B\", if it\u0027s blue."}},{"title":"Output","value":{"format":"MD","content":"Print a single integer — the minimum number of beads to remove in order to make the *kandie* colorful."}},{"title":"Testcases","value":{"format":"MD","content":"**Input 1**\n```textplain\n3\nRRG\n```\n**Output 1**\n```textplain\n1\n```\n---\n**Input 2**\n```textplain\n5\nRRRRR\n```\n**Output 2**\n```textplain\n4\n```\n---\n**Input 3**\n```textplain\n4\nBRBG\n```\n**Output 3**\n```textplain\n0\n```"}}]}