/*input
5
2
**
**
3
***
*..
3
*..
.*.
12
.**.*..*****
.**..***.*.*
6
*.*.*.
.*.*.*
*/
#include<bits/stdc++.h>
 
using namespace std;
 
int test, n, board[5][100005], check[5];
 
void Init(){
	cin >> n;
	// a = b = 0;
	check[1] = check[2] = 0;
	for(int i = 1; i <= 2; i++){
		for(int j = 1; j <= n; j++){
			char cak;
			cin >> cak;
			if(cak == '*') board[i][j] = 1, check[i] = 1;
			else board[i][j] = 0;
		}
	}
	return;
}	
 
void Solve(){
	int res = 0;
	if(check[1] && check[2]) res++;
	check[1] = check[2] = 0;
	for(int i = 1; i <= n; i++){
		if(check[1] && board[1][i]){
			check[2] = board[2][i];
			res++;
		}
		else if(check[2] && board[2][i]){
			check[1] = board[1][i];
			res++;
		}
		else{
			check[1] = max(check[1],board[1][i]); check[2] = max(check[2], board[2][i]);
		}
	}
	cout << res << '\n';
}
 
signed main(){
	ios_base::sync_with_stdio(0);
	cin >> test;
	while(test--){
		Init();
		Solve();
	}
} 