/* @file 11461.c
 * @date 04/24/2011
 * @version v0.01
 * @author "TXShon" <txshon@gmail.com>
 * @note CreativeCommons(cc) 2011 TXShon, cc by-nc-nd
 *
 *Description
 *	Acm practice using c
 *History
 */
#include <stdio.h>

int num[100500];

int main()
{
	int a, b, k, kk,i;
	
	k = 1;
	kk = 1;
	for( i=0; i<100003; i++){
		num[i]=k-1;
		if(i==kk){
			k++;
			kk=k*k;
		}
	}
	
	while( scanf("%d%d", &a, &b)==2){
		if( a==0 && b==0)break;
		printf("%d\n", num[b+1]-num[a]);
	}
	return 0;
}
