#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
void solve(int cs) {
map<int,int> cnt;
for (int i = 0; i < 3; i++) {
int x;
cin >> x;
cnt[x] += 1;
}
if (cnt.size() == 1) cout << "0\n";
else if (cnt.size() == 3) cout << "2\n";
else {
// if (cnt.begin() -> second == 1) {
// cout << "2\n";
// } else {
// cout << "1\n";
// }
cout << 1 << "\n";
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tc = 1;
cin >> tc;
for (int cs = 1; cs <= tc; cs++) {
solve(cs);
}
return 0;
}