#include <iostream>
#include <deque>

using namespace std;

int main(){
	freopen ("FLOAT.IN","r",stdin);

	int am_tests;
	cin>>am_tests;

	for (int test=0;test<am_tests;test++){
		__int64 a,b;
		cin >> a >> b;
		__int64 count = 0;
		for (__int64 i = a; i<=b; i++){
			float test = i;
			if (test == i) count++;
		}
		cout << count << endl;
	}
	return 0;
}