n = int(input()) c = list(map(int, input().split())) c.append(0) print(2*(max(c)-min(c)))