N=int(input()) A=list(map(int,input().split())) M=max(A) ANS=0 for i in range(N): if abs(A[i])>M: ANS+=abs(A[i]) else: ANS+=M print(ANS)