#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld long double
#define fi first
#define se first
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define scan1(a); int a; cin >> a
#define scan2(a, b); int a, b; cin >> a >> b
#define scan3(a, b, c); int a, b, c; cin >> a >> b >> c
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i = a;i<=b;i++)
#define rep3(i,a,b) for(ll i= a;i>=b;i--)
#define mod 1000000007
//vector<char> alpha{'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
template <class T> vector<T> divisor(T x) {
    vector<T> ans;
    for(T i = 1; i * i <= x; i++)
        if(x % i == 0) {
            ans.pb(i);
            if(i * i != x) ans.pb(x / i);
        }
    return ans;
}
template <class T> T POW(T x, int n) {
    T res = 1;
    for(; n; n >>= 1, x *= x)
        if(n & 1) res *= x;
    return res;
}
vector<pll> factorisation(ll x) {
    vector<pll> ans;
    for(ll i = 2; i * i <= x; i++)
        if(x % i == 0) {
            ans.pb({i, 1});
            while((x /= i) % i == 0) ans.back().se++;
        }
    if(x != 1) ans.pb({x, 1});
    return ans;
}
int mult(int a,int b){
    return ((ll)a*b)%mod;
}

void solve(){
      int n;
    string s;
    cin >> n;
    cin >> s;
    vi she;
    for(int i=0; i<n; i++){
        if(s[i] == '*') she.push_back(i);
    }

    int ct = she.size();
    ll ans = 0;
    for(int i=ct/2; i<ct-1; i++){
        if(she[i+1] != she[i] + 1){
            ans += she[i+1] - she[i] - 1;
        }
        she[i+1] = she[i] + 1;
    }
    //cout << '$' << ct << endl;;
    for(int i=ct/2; i>0; i--){
        if(she[i-1] != she[i] - 1){
            ans += she[i] - she[i-1] - 1;
        }
        she[i-1] = she[i] - 1;
    }
    cout << ans << endl;
}

int main(){
    ios_base::sync_with_stdio(0);
        cin.tie(0);
    //int testcases=1;
    scan1(testcases);
    while(testcases--){
        solve();
    }
    return 0;
}

### Prompt

Generate a Cpp solution to the following problem:

You are playing the game "Arranging The Sheep". The goal of this game is to make the sheep line up. The level in the game is described by a string of length n, consisting of the characters '.' (empty space) and '*' (sheep). In one move, you can move any sheep one square to the left or one square to the right, if the corresponding square exists and is empty. The game ends as soon as the sheep are lined up, that is, there should be no empty cells between any sheep.

For example, if n=6 and the level is described by the string "**.*..", then the following game scenario is possible: 

  * the sheep at the 4 position moves to the right, the state of the level: "**..*."; 
  * the sheep at the 2 position moves to the right, the state of the level: "*.*.*."; 
  * the sheep at the 1 position moves to the right, the state of the level: ".**.*."; 
  * the sheep at the 3 position moves to the right, the state of the level: ".*.**."; 
  * the sheep at the 2 position moves to the right, the state of the level: "..***."; 
  * the sheep are lined up and the game ends. 



For a given level, determine the minimum number of moves you need to make to complete the level.

Input

The first line contains one integer t (1 ≤ t ≤ 10^4). Then t test cases follow.

The first line of each test case contains one integer n (1 ≤ n ≤ 10^6).

The second line of each test case contains a string of length n, consisting of the characters '.' (empty space) and '*' (sheep) — the description of the level.

It is guaranteed that the sum of n over all test cases does not exceed 10^6.

Output

For each test case output the minimum number of moves you need to make to complete the level.

Example

Input


5
6
**.*..
5
*****
3
.*.
3
...
10
*.*...*.**


Output


1
0
0
0
9

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld long double
#define fi first
#define se first
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define scan1(a); int a; cin >> a
#define scan2(a, b); int a, b; cin >> a >> b
#define scan3(a, b, c); int a, b, c; cin >> a >> b >> c
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i = a;i<=b;i++)
#define rep3(i,a,b) for(ll i= a;i>=b;i--)
#define mod 1000000007
//vector<char> alpha{'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
template <class T> vector<T> divisor(T x) {
    vector<T> ans;
    for(T i = 1; i * i <= x; i++)
        if(x % i == 0) {
            ans.pb(i);
            if(i * i != x) ans.pb(x / i);
        }
    return ans;
}
template <class T> T POW(T x, int n) {
    T res = 1;
    for(; n; n >>= 1, x *= x)
        if(n & 1) res *= x;
    return res;
}
vector<pll> factorisation(ll x) {
    vector<pll> ans;
    for(ll i = 2; i * i <= x; i++)
        if(x % i == 0) {
            ans.pb({i, 1});
            while((x /= i) % i == 0) ans.back().se++;
        }
    if(x != 1) ans.pb({x, 1});
    return ans;
}
int mult(int a,int b){
    return ((ll)a*b)%mod;
}

void solve(){
      int n;
    string s;
    cin >> n;
    cin >> s;
    vi she;
    for(int i=0; i<n; i++){
        if(s[i] == '*') she.push_back(i);
    }

    int ct = she.size();
    ll ans = 0;
    for(int i=ct/2; i<ct-1; i++){
        if(she[i+1] != she[i] + 1){
            ans += she[i+1] - she[i] - 1;
        }
        she[i+1] = she[i] + 1;
    }
    //cout << '$' << ct << endl;;
    for(int i=ct/2; i>0; i--){
        if(she[i-1] != she[i] - 1){
            ans += she[i] - she[i-1] - 1;
        }
        she[i-1] = she[i] - 1;
    }
    cout << ans << endl;
}

int main(){
    ios_base::sync_with_stdio(0);
        cin.tie(0);
    //int testcases=1;
    scan1(testcases);
    while(testcases--){
        solve();
    }
    return 0;
}

```