N = int(input()) C = list(map(int, input().split())) C.sort() print(max(abs(abs(sum(C[N//2+1:]))-abs(sum(C[:N//2+1]))), abs(abs(sum(C[N//2:]))-abs(sum(C[:N//2])))))