n = int(input()) C = list(map(int, input().split())) mi = min(C) ma = max(C) print(max(0, ma) * 2 - min(0, mi) * 2)