#include <iostream>
#include <cstdio>
#include <map>
using namespace std;

int main()
{
	freopen("edit.in","r",stdin);
	freopen("edit.out","w",stdout);
	int T;
	cin >> T;
	while(T--)
	{
		int n;
		string s1,s2,t1,t2;
		cin >> n >> s1 >> s2 >> t1 >> t2;
		if(n<=10)
		{
			int ans=0;
			for(int i=0;i<n;i++)
			{
				if(s1[i]==s2[i])ans++;
			}
			cout << ans << endl;
		}
		else
		{
			int ans=0;
			for(int i=0;i<n;i++)
			{
				if(s1[i]==s2[i])ans++;
			}
			cout << ans << endl;
		}
	}
	return 0;
}
