input() c = [0] + list(map(int, input().split())) print(2 * (max(c) - min(c)))