main=do getLine a<-getLine>>=return.map(read::String->Int).words let b0=head a a1=sum a a1'=sum$zipWith(*)a(cycle[1,-1]) b1=(a1-a1')`div`2 b2=(a1+a1')`div`2-b0 r=(reverse.dropWhile(==0).reverse)[b0,b1,b2] print$length r-1 putStrLn$(unwords.map show)r