You have a string ss consisting of nn characters. Each character is either 0 or 1.
You can perform operations on the string. Each operation consists of two steps:
select an integer ii from 11 to the length of the string ss, then delete the character sisi (the string length gets reduced by 11, the indices of characters to the right of the deleted one also get reduced by 11);
if the string ss is not empty, delete the maximum length prefix consisting of the same characters (the indices of the remaining characters and the string length get reduced by the length of the deleted prefix).
Note that both steps are mandatory in each operation, and their order cannot be changed.
For example, if you have a string s=s= 111010, the first operation can be one of the following:
select i=1i=1: we‘ll get 111010 →→ 11010 →→ 010;
select i=2i=2: we‘ll get 111010 →→ 11010 →→ 010;
select i=3i=3: we‘ll get 111010 →→ 11010 →→ 010;
select i=4i=4: we‘ll get 111010 →→ 11110 →→ 0;
select i=5i=5: we‘ll get 111010 →→ 11100 →→ 00;
select i=6i=6: we‘ll get 111010 →→ 11101 →→ 01.
You finish performing operations when the string ss becomes empty. What is the maximum number of operations you can perform?
Input
The first line contains a single integer tt (1≤t≤10001≤t≤1000) — the number of test cases.
The first line of each test case contains a single integer nn (1≤n≤2?1051≤n≤2?105) — the length of the string ss.
The second line contains string ss of nn characters. Each character is either 0 or 1.
It‘s guaranteed that the total sum of nn over test cases doesn‘t exceed 2?1052?105.
Output
For each test case, print a single integer — the maximum number of operations you can perform.
Example
input
Copy
5
6
111010
1
0
1
1
2
11
6
101010
output
Copy
3
1
1
1
3
Note
In the first test case, you can, for example, select i=2i=2 and get string 010 after the first operation. After that, you can select i=3i=3 and get string 1. Finally, you can only select i=1i=1 and get empty string.
You are given a string ss. You have to reverse it — that is, the first letter should become equal to the last letter before the reversal, the second letter should become equal to the second-to-last letter before the reversal — and so on. For example, if your goal is to reverse the string "abddea", you should get the string "aeddba". To accomplish your goal, you can swap the neighboring elements of the string.
Your task is to calculate the minimum number of swaps you have to perform to reverse the given string.
Input
The first line contains one integer nn (2≤n≤2000002≤n≤200000) — the length of ss.
The second line contains ss — a string consisting of nn lowercase Latin letters.
Output
Print one integer — the minimum number of swaps of neighboring elements you have to perform to reverse the string.
Examples
input
Copy
5
aaaza
output
Copy
2
input
Copy
6
cbaabc
output
Copy
0
input
Copy
9
icpcsguru
output
Copy
30
Note
In the first example, you have to swap the third and the fourth elements, so the string becomes "aazaa". Then you have to swap the second and the third elements, so the string becomes "azaaa". So, it is possible to reverse the string in two swaps.
Since the string in the second example is a palindrome, you don‘t have to do anything to reverse it.