#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
const int N=1e5+5;
int T,n,ans;
string s0,s1,t0,t1;
int main(){
	freopen("edit.in","r",stdin);
	freopen("edit.out","w",stdout);
	cin>>T;
	while(T--){
		cin>>n;
		cin>>s0>>s1>>t0>>t1;
		ans=0;
		for(int i=0;i<n;i++){
			if(s0[i]==s1[i]) ans++;
		}
		printf("%d\n",ans);
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
