n,*c=map(int,open(0).read().split()) if c[0]*c[-1]<0: ans=2*(c[-1]-c[0]) else: if c[0]<0: ans=-c[0]*2 else: ans=c[-1]*2 print(ans)