# your code goes here D=int(input()) a=[int (i) for i in input (). split ()] while len(a)>3: a[2]+=a[0] a.pop(0) # print (a) print (len(a)-1) i=len(a)-1 b="" while i>=0: b+=str(a[i])+" " i-=1 print (b)