#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fileIO freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define ammario main
typedef long long ll;
void pls_werk_b0ss()
{
int n;cin>>n;
string s,t;cin>>s>>t;
cout<<(s==t?0:1)<<"\n";
}
int ammario()
{
fastIO
int t=1;cin>>t;
while(t--)pls_werk_b0ss();
}