#include <bits/stdc++.h>
#define ll long long
#define endll '\n';
#define pb push_back
#define all(v) v.begin(), v.end()
using namespace std;
const int mod = 1e9 + 7, N = 1e6;
void solve()
{
int a , b, c; cin >> a >> b >> c;
map<int,int> mp;
mp[a]++;
mp[b]++;
mp[c]++;
if(mp.size() == 1) {
cout << 0 << endll;
}
else if(mp.size() == 2) {
cout << 1 << endll;
}
else {
cout <<2 << endll;
}
}
int32_t main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int t = 1;
cin >> t;
while (t--) {
solve();
}
return 0;
}