#include <bits/stdc++.h>
using namespace std;
// Speed
#define fast_io ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
// Typedefs
#define int long long
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define endl '\n'
#define yes cout << "yes\n"
#define no cout << "no\n"
// Loops
#define rep(i,a,b) for(int i=a;i<b;++i)
#define per(i,a,b) for(int i=b-1;i>=a;--i)
#define each(x, a) for (auto& x : a)
// Consts
const int INF = 1e18;
const int MOD = 1e9+7;
const int N = 2e5 + 5;

void solve() {
	int n;
	cin>>n;
    string s;
    cin >> s;
    int ans=0;
    rep(i,0,n){
        if (s[i]=='.') {
            int j=i+1;
            while (j<n && s[j]=='.') {
                j++;
            }
            int len=j-i;
            ans+=min(len,(long long)2);
            i=j-1;
        }
    }
    cout<<ans<< endl;
}

int32_t main() {
    fast_io;
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}