#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 5;

int T;
int n;

char s1[N];
char s2[N];
char t1[N];
char t2[N];

void solv() {
    cin >> n;
    cin >> s1 + 1 >> s2 + 1 >> t1 + 1 >> t2 + 1;
    int ans = 0;
    for (int i=1;i<=n;++i) {
        ans += (s2[i] == s1[i]);
    }
    cout << ans << endl;
}

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    freopen("edit.in", "r", stdin);
    freopen("edit.out", "w", stdout);

    cin >> T;
    while(T--) solv();

}
/*

谢谢你的终场演出
晚安 麦麦头

*/