/*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();
}
}
LyppbnB1dAo1CjIKKioKKioKMwoqKioKKi4uCjMKKi4uCi4qLgoxMgouKiouKi4uKioqKioKLioqLi4qKiouKi4qCjYKKi4qLiouCi4qLiouKgoqLwojaW5jbHVkZTxiaXRzL3N0ZGMrKy5oPgogCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiAKaW50IHRlc3QsIG4sIGJvYXJkWzVdWzEwMDAwNV0sIGNoZWNrWzVdOwogCnZvaWQgSW5pdCgpewoJY2luID4+IG47CgkvLyBhID0gYiA9IDA7CgljaGVja1sxXSA9IGNoZWNrWzJdID0gMDsKCWZvcihpbnQgaSA9IDE7IGkgPD0gMjsgaSsrKXsKCQlmb3IoaW50IGogPSAxOyBqIDw9IG47IGorKyl7CgkJCWNoYXIgY2FrOwoJCQljaW4gPj4gY2FrOwoJCQlpZihjYWsgPT0gJyonKSBib2FyZFtpXVtqXSA9IDEsIGNoZWNrW2ldID0gMTsKCQkJZWxzZSBib2FyZFtpXVtqXSA9IDA7CgkJfQoJfQoJcmV0dXJuOwp9CQogCnZvaWQgU29sdmUoKXsKCW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