#include<stdio.h>
#include<stdbool.h>
bool SelectYear(int x){
if(x % 100 != 0 && x % 4 == 0 || x % 400 == 0){
return true;
}
return false;
}
int main(){
int x,y;
int i = 0;
int a[2000];
scanf("%d %d",&x,&y);
// bool s = SelectYear(x);
while(x < y){
if(SelectYear(x)){
a[i] = x;
i++;
}
x++;
}
printf("%d\n",i);
for(int j = 0; j < i; j++){
printf("%d ",a[j]);
}
return 0;
}