n = list(map(int,input().split())) def rn(n): if ((n % 400 == 0) or ((n % 4 == 0) and (n // 100 != 0))): return 1 else: return 0 s = [] for i in range(n[0],n[1]+1): if rn(i): s.append(i) print(len(s)) for j in s: print(j,end=' ')