N = int(input()) C = list(map(int, input().split())) mn = min(C) mx = max(C) ans = abs(mn) + (mx - mn) + abs(mx) print(ans)