#include<bits/stdc++.h> using namespace std; typedef long long ll; #define fi first #define se second const int N=2e5+1; int n; int d(ll x){ int s=0; while(x>0){ s+=x%10;x/=10; } return s; } bool check(int x,int y,int z){ vector<int>v; v.push_back(x);v.push_back(y);v.push_back(z); sort(v.begin(),v.end()); for(auto c:v){ if(c<=0 || c>n) return false; } if(v[1]==v[0]+1 && v[2]==v[1]+1) return true; else return false; } void solve(){ int a,b; cin >> n >> a >> b; int ans=0; if(check(a,b,min(a,b)-1)) ans++; if(check(a,b,min(a,b)+1)) ans++; if(check(a,b,max(a,b)+1)) ans++; cout << ans << '\n'; } int main(){ ios::sync_with_stdio(false);cin.tie(0); int t;cin >> t;while(t--) solve(); }