1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. #define fi first
  5. #define se second
  6. const int N=2e5+1;
  7. int n;
  8. int d(ll x){
  9. int s=0;
  10. while(x>0){
  11. s+=x%10;x/=10;
  12. }
  13. return s;
  14. }
  15. bool check(int x,int y,int z){
  16. vector<int>v;
  17. v.push_back(x);v.push_back(y);v.push_back(z);
  18. sort(v.begin(),v.end());
  19. for(auto c:v){
  20. if(c<=0 || c>n) return false;
  21. }
  22. if(v[1]==v[0]+1 && v[2]==v[1]+1) return true;
  23. else return false;
  24. }
  25. void solve(){
  26. int a,b;
  27. cin >> n >> a >> b;
  28. int ans=0;
  29. if(check(a,b,min(a,b)-1)) ans++;
  30. if(check(a,b,min(a,b)+1)) ans++;
  31. if(check(a,b,max(a,b)+1)) ans++;
  32. cout << ans << '\n';
  33. }
  34. int main(){
  35. ios::sync_with_stdio(false);cin.tie(0);
  36. int t;cin >> t;while(t--) solve();
  37. }