#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
int t;
cin>>t;
while(t--){
int n;
string s;
cin>>n;
cin>>s;
int pointsCount=0;
int len=0, maxLen=0;
for(int i=0;i<n;i++){
if(s[i]=='.'){
len++;
pointsCount++;
maxLen=max(maxLen, len);
} else {
len=0;
}
}
if(pointsCount==0){
cout<<0<<endl;
continue;
}
if(maxLen < 3){
cout<<pointsCount<<endl;
} else {
cout<<2<<endl;
}
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgbGwgbG9uZyBsb25nIGludAoKaW50IG1haW4oKSB7CglpbnQgdDsKCWNpbj4+dDsKCXdoaWxlKHQtLSl7CgkJaW50IG47CgkJc3RyaW5nIHM7CgkJY2luPj5uOwoJCWNpbj4+czsKCQkKCQlpbnQgcG9pbnRzQ291bnQ9MDsKCQlpbnQgbGVuPTAsIG1heExlbj0wOwoJCQoJCWZvcihpbnQgaT0wO2k8bjtpKyspewoJCQlpZihzW2ldPT0nLicpewoJCQkJbGVuKys7CgkJCQlwb2ludHNDb3VudCsrOwoJCQkJbWF4TGVuPW1heChtYXhMZW4sIGxlbik7CgkJCX0gZWxzZSB7CgkJCQlsZW49MDsKCQkJfQoJCX0KCQkKCQlpZihwb2ludHNDb3VudD09MCl7CgkJCWNvdXQ8PDA8PGVuZGw7CgkJCWNvbnRpbnVlOwoJCX0gCgkJaWYobWF4TGVuIDwgMyl7CgkJCWNvdXQ8PHBvaW50c0NvdW50PDxlbmRsOwoJCX0gZWxzZSB7CgkJCWNvdXQ8PDI8PGVuZGw7CgkJfQoJfQoJcmV0dXJuIDA7Cn0=