n = int(input()) a = list(map(int, input().split())) m = max(a) abs_m = abs(m) total = 0 for num in a: total += max(abs(num), abs_m) print(total)