#include<bits/stdc++.h>
using namespace std;
bool rn(int n)
{
if(n%4!=0&&n%400!=0||n%100==0)
{
return 0;
}
else return 1;
}
int main()
{
int x,y;
cin>>x>>y;
int i=0;
for(;x<=y;x++)
{
if(rn(x)==1)
{
i++;
}
}
cout<<i<<endl;
for(;x<=y;x++)
{
if(rn(x==1))
{
cout<<x<<' '
}
}
return 0;
}