#include <stdio.h>
int main()
{
int a,b,i,counter=0;
int n1,n2,n3,n4;
do {scanf("%d",&a);
scanf("%d",&b);
}
while(a!=0);{
if(a==0||b==0)
printf("\n");
else
{
if(a<1000||b<1000)
printf("Error\n");
else
{
for(i=a;i<=b;i++)
{
if(i%2==0)
{
n4=i/1000;
n3=(i%1000)/100;
n2=(i%1000)%100/10;
n1=(i%1000)%100%10;
if(n4!=n3&&n4!=n2&&n4!=n1&&n3!=n2&&n3!=n1&&n2!=n1)
{
counter++;
printf("%-6d",i);
}
}
}
printf("\n");
printf("%d\n",counter);
}
}
}
return 0;
}
}