#include<bits/stdc++.h>
using namespace std;
bool a[100001],b[100001],f1[100001],f2[100001];
long long ans;
long long n,t;
string s;
int main(){
//	freopen("edit.in","r",stdin);
//	freopen("edit.out","w",stdout);
	cin>>t;
	while(t--){
		cin>>n;
		ans=0;
		cin>>s;
		for(long long i=1;i<=n;i++){
			a[i]=s[i-1]-'0';
		}
		cin>>s;
		for(long long i=1;i<=n;i++){
			b[i]=s[i-1]-'0';
			ans+=(b[i]==a[i]);
		}cin>>s;
		cin>>s;
		cout<<ans;
		
	}
} 
