#include <bits/stdc++.h>
using namespace std ; 
 
int main ()
{  
   int t ; cin >> t; 
   while(t--)
   {
     long long n ; cin >> n ;
     vector<long long> a(n) ; 
    vector<long long> b(n) ,f(n) ;
    int c[n+1] ; long long d = 0 ; long long e  = 0 ; 
     for(int i = 0 ; i<=n-1 ; i++)
     {
         long long x ,y; cin >> x >> y ;
         a[i] = x ;b[i]= y ;
        
     }  
     f =b ; 
     c[0] = 0 ; long long k = 0 ;
    for(int i = 1 ; i<n ; i++)
    {   
    if(b[i-1]==c[i-1]){ k = 0 ; }
    else { k = abs(b[i-1]-c[i-1])/(b[i-1]-c[i-1]) ; }
        
       if(a[i]-a[i-1]>=abs(b[i-1]-c[i-1])){ c[i] = b[i-1] ; } 
        if(a[i]-a[i-1]<abs(b[i-1]-c[i-1]))
        { c[i] = c[i-1] + k*(a[i]-a[i-1]) ;b[i] = b[i-1] ;  }
       
    }

   c[n] = b[n-1] ; 
    for(int i = 1 ; i<=n ; i++)
    {
        if((c[i]>=f[i-1] && c[i-1]<=f[i-1]) || (c[i]<=f[i-1] && c[i-1]>=f[i-1]))
        {
            d++ ;
        }
    }
 cout << d << endl ;
}

}

    
     