School's back! You're up to no good again already… While your art teacher, Roger, was looking away, you grab his basket of Crayola™ markers and started connecting them together.
This creates a colorful sword that you can use to hit people that you find annoying with. You want to be able to reach quite far with your sword though, so you keep on connecting.
Although you want your crayon lightsaber to be as long as possible, you also care deeply about it being aesthetically pleasing. For that reason, you choose to never connect two crayons of the same color directly together.
Given the colors of the markers in the basket, what is the longest Crayola™ marker sword you can construct?
The first line will contain an integer . This will then be followed by a line of strings that represent the colors of the markers. The colors can be: red, orange, yellow, green, blue, black.
The only output is an integer representing the maximum length possible for the marker sword.
Sample Input 1
4 red blue green black
Sample Output 1
Sample Input 2
5 yellow orange yellow yellow yellow
Sample Output 2
Explanation for Sample Outputs
For the first example, you can use every marker to make a sword such as the one in the image above.
For the second example, the longest sword you can make is using the markers yellow-orange-yellow, resulting in a length of .