#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fast ios::sync_with_stdio(false);cin.tie(nullptr)
ll gcd(ll a, ll b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
return a / gcd(a, b) * b;
}
string toupper(string a) {
for (int i = 0; i < (int)a.size(); ++i)
if (a[i] >= 'a' && a[i] <= 'z')
a[i] -= 32;
return a;
}
string tolower(string a) {
for (int i = 0; i < (int)a.size(); ++i)
if (a[i] >= 'A' && a[i] <= 'Z')
a[i] += 32;
return a;
}
bool prime(ll a) {
if (a == 1)
return false;
for (int i = 2; i <= round(sqrt(a)); ++i)
if (a % i == 0)
return false;
return true;
}
constexpr long long pow(long long a, long long b) {
long long res = 1;
for (; b; b /= 2, a *= a) {
if (b % 2)
res *= a;
}
return res;
}
constexpr int factorial(int k) {
int res = 1;
for (int i = 2; i <= k; i++)
res *= i;
return res;
}
bool check() {
return true;
}
bool cmp(pair<int, int> a, pair<int, int> b) {
if (a.first == b.first) return (a.second > b.second);
return (a.first < b.first);
}
bool check(int a, int b, int c) {
if ( a== b && b == c && a == c) {
return true;
}
else return false;
}
int main () {
fast;
int tc;
cin >> tc;
while (tc--) {
int a, b, c, ans=0;
cin >> a >> b >> c;
if (a==b) {
if (b != c) {
ans++;
c = a;
}
}
if (b==c) {
if (c != a) {
ans++;
a = c;
}
}
cout << ans << endl;
}
return 0;
}