Doubt regarding output

what should be the output if the testcase is:
3
aabbabb

You can change all the a’s into b, so the answer is 7.