#yuki286 N=int(raw_input()) M=[] for i in xrange(N): M.append(int(raw_input())) dp=[1<<20 for i in xrange(1<