Problem: Mark has just purchased a rack of lightbulbs. The state of the lightbulbs can be described with binary string , where means that the -th lightbulb is turned on, while means that the -th lightbulb is turned off.
Unfortunately, the lightbulbs are broken, and the only operation he can perform to change the state of the lightbulbs is the following:
- Select an index from such that .
- Toggle . Namely, if is , set to or vice versa.
Mark wants the state of the lightbulbs to be another binary string . Help Mark determine the minimum number of operations to do so.
Input Format: The first line of the input contains a single integer () — the number of test cases.
The first line of each test case contains a single integer () — the number of lightbulbs.
The second line of each test case contains a binary string of length — the initial state of the lightbulbs.
The third line of each test case contains a binary string of length — the final state of the lightbulbs.
It is guaranteed that the sum of across all test cases does not exceed .
Output Format: For each test case, print a line containing the minimum number of operations Mark needs to perform to transform to . If there is no such sequence of operations, print .
Note: In the first test case, one sequence of operations that achieves the minimum number of operations is the following.
- Select , changing to .
- Select , changing to .
In the third test case, even though the first digits of and are the same and the last digits of and are the same, it can be shown that there is no sequence of operations that satisfies the condition.
In the fourth test case, one sequence that achieves the minimum number of operations is the following:
- Select , changing to .
- Select , changing to .
- Select , changing to .
- Select , changing to .
- Select , changing to .