There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x_1, the second friend lives at the point x_2, and the third friend lives at the point x_3. They plan to celebrate the New Year together, so they need to meet at one point. What is the minimum total distance they have to travel in order to meet at some point and celebrate the New Year?

It's guaranteed that the optimal answer is always integer.


-----Input-----

The first line of the input contains three distinct integers x_1, x_2 and x_3 (1 ≤ x_1, x_2, x_3 ≤ 100) — the coordinates of the houses of the first, the second and the third friends respectively. 


-----Output-----

Print one integer — the minimum total distance the friends need to travel in order to meet together.


-----Examples-----
Input
7 1 4

Output
6

Input
30 20 10

Output
20



-----Note-----

In the first sample, friends should meet at the point 4. Thus, the first friend has to travel the distance of 3 (from the point 7 to the point 4), the second friend also has to travel the distance of 3 (from the point 1 to the point 4), while the third friend should not go anywhere because he lives at the point 4.

Difficulty: EASY
Tags: Mathematics

Sorting

Implementation
Skill types: Sorting

Starter code:

Solutions:
(a, b, c) = map(int, input().strip().split())
l = []
l.append(a)
l.append(b)
l.append(c)
l.sort()
el = l[1]
ans = abs(el - a) + abs(el - b) + abs(el - c)
print(ans)


x = input().split(' ')
for i in range(len(x)):
	x[i] = int(x[i])
x.sort()
print(x[2] - x[0])


a = list(map(int, input().rstrip().split()))
print(max(a) - min(a))


(a, b, c) = map(int, input().split())
n = (a + b + c) / 3
sum = 0
sum = abs(n - a) + abs(n - b) + abs(n - c)
sum1 = abs(b - a) + abs(c - a)
sum = min(sum, sum1)
sum2 = abs(a - b) + abs(c - b)
sum = min(sum, sum2)
sum3 = abs(a - c) + abs(b - c)
sum = min(sum, sum3)
print(int(sum))


l = list(map(int, input().split(' ')))
m = sorted(l)
d = m[2] - m[0]
print(d)


a = list(map(int, input().split()))
a.sort()
b = a.pop(2) - a.pop(0)
print(b)


l = list(map(int, input().split()))
mi = abs(l[0] - l[1]) + abs(l[0] - l[2])
if mi > abs(l[1] - l[0]) + abs(l[1] - l[2]):
	mi = abs(l[1] - l[0]) + abs(l[1] - l[2])
if mi > abs(l[2] - l[0]) + abs(l[1] - l[2]):
	mi = abs(l[2] - l[0]) + abs(l[1] - l[2])
print(mi)


import math
from fractions import Fraction as frac
MOD = 1000000000.0 + 7

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def solve(case_no):
	(a, b, c) = map(int, input().split())
	ans = 1000
	for i in range(0, 101):
		now = abs(a - i) + abs(b - i) + abs(c - i)
		if now <= ans:
			ans = now
		else:
			print(ans)
			exit()
t = 1
for i in range(1, t + 1):
	solve(i)


a = list(map(int, input().split()))
x = min(a)
y = max(a)
z = sum(a)
q = z - (x + y)
way = y - q + (q - x)
print(way)


a = [int(i) for i in input().split()]
a.sort()
print(a[2] - a[0])


a = sorted(list(map(int, input().split())))
d = a[2] - a[1] + (a[1] - a[0])
print(d)


List = [int(j) for j in input().split(' ')]
List.sort()
place = List[1]
print(abs(List[0] - place) + abs(List[2] - place))


e = list(map(int, input().split()))
a = e[0] + e[1] + e[2]
a -= min(e)
a -= max(e)
print(a - min(e) + (max(e) - a))


(a, b, c) = map(int, input().split())
x = max(a, b, c)
y = min(a, b, c)
z = x - y
print(z)


(a, b, c) = map(int, input().split())
e = max(a, b, c) - min(a, b, c)
print(e)


L = [int(i) for i in input().strip().split()]
print(max(L) - min(L))


(a, b, c) = sorted(list(map(int, input().split())))
print(c - a)


x = [int(x) for x in input().split()]
x.sort()
print(x[2] - x[0])


(x, y, z) = sorted(list(map(int, input().split())))
print(z - x)


line = input()
strings = line.split()
list = []
for string in strings:
	list.append(eval(string))
sortedList = sorted(list)
size = len(list)
print(sortedList[2] - sortedList[0])


frnds = list(map(int, input().split(' ')))
frnds.sort()
print(frnds[2] - frnds[1] + (frnds[1] - frnds[0]))


b = list(map(int, input().split()))
mi = min(b)
ma = max(b)
b.remove(mi)
b.remove(ma)
av = max(b)
print(ma - av + (av - mi))


list1 = list(map(int, input().split(' ')))
list1.sort()
b = list1[0]
c = list1[1]
d = list1[2]
list1.clear()
list1.append(c - b + (d - b))
list1.append(c - b + (d - c))
list1.append(c - b + (d - c))
print(min(list1))


kk = [int(x) for x in input().split()]
print(max(kk) - min(kk))


(x1, x2, x3) = input().split()
x1 = int(x1)
x2 = int(x2)
x3 = int(x3)
h = max(x1, x2, x3)
l = min(x1, x2, x3)
if x1 > l and x1 < h:
	d1 = h - x1
	d2 = x1 - l
	print(d1 + d2)
elif x2 > l and x2 < h:
	d1 = h - x2
	d2 = x2 - l
	print(d1 + d2)
else:
	d1 = h - x3
	d2 = x3 - l
	print(d1 + d2)


import sys
input = sys.stdin.readline
friends = list(map(int, input().split()))

def calc(friends, pos):
	return sum((abs(pos - f) for f in friends))
best = float('inf')
for pos in range(1, 101):
	cost = calc(friends, pos)
	if cost < best:
		best = cost
print(best)


s = list(map(int, input().split()))
print(max(s) - min(s))


LIST = [int(s) for s in input().split()]
LIST.sort()
total = 0
total += LIST[1] - LIST[0]
total += LIST[2] - LIST[1]
print(total)


(x1, x2, x3) = map(int, input().split())
p = max(x1, x2, x3)
l = min(x1, x2, x3)
print(p - l)


def main():
	l = list(map(int, input().split()))
	print(max(l) - min(l))
main()


a = list(map(int, input().split()))
a.sort()
d = a[2] - a[0]
print(abs(d))


n = input()
lst = list(map(int, n.split()))
lst.sort()
v = lst[1]
lst.pop(1)
ans = 0
for i in lst:
	val = abs(i - v)
	ans += val
print(ans)


(n, m, b) = map(int, input().split())
a = [n, m, b]
a = sorted(a)
print(a[2] - a[0])


(a, b, c) = input().split()
a = int(a)
b = int(b)
c = int(c)
mid = a
if a > b and a > c:
	if b > c:
		mid = b
	else:
		mid = c
elif b > a and b > c:
	if a > c:
		mid = a
	else:
		mid = c
elif a > b:
	mid = a
else:
	mid = b
minDist = abs(mid - a) + abs(mid - b) + abs(mid - c)
print(minDist)


s = input()
w = s.split()
a = [int(x) for x in w]
b = sorted(a)
otv = b[2] - b[0]
print(otv)


l = list(map(int, input().split()))
l.sort()
print(l[1] - l[0] + l[-1] - l[1])


n = list(map(int, input().split()))
n.sort()
mid = len(n) // 2
print(n[mid] - n[0] + n[-1] - n[mid])


x = list(map(int, input().split()))
z = sorted(x)
if len(x) % 2 == 0:
	y = len(x) / 2
else:
	y = int(len(x) / 2)
dis = 0
for i in range(len(x)):
	if z[i] < z[y]:
		dis += z[y] - z[i]
	else:
		dis += z[i] - z[y]
print(dis)


li = list(map(int, input().split()))
li.sort()
x = li[1]
x = abs(x - li[0]) + abs(x - li[2])
print(x)


(x1, x2, x3) = map(int, input().split())
t = []

def smax(x1, x2, x3):
	l = [x1, x2, x3]
	l.sort()
	return l
t = smax(x1, x2, x3)
print(t[1] - t[0] + (t[2] - t[1]))


(a, b, c) = map(int, input().split())
print(abs(max(a, b, c) - min(a, b, c)))


a = [int(x) for x in input().split()]
print(max(a) - min(a))


q = sorted(map(int, input().split(' ')))
print(q[-1] - q[0])


def solve():
	(x, y, z) = list(map(int, input().split()))
	print(min(abs(y - x) + abs(z - x), abs(x - y) + abs(z - y), abs(x - z) + abs(y - z)))
solve()


l = [int(x) for x in input().split()]
l.sort()
print(l[-1] - l[0])


l = []
(a, b, c) = map(int, input().split())
l.append(a)
l.append(b)
l.append(c)
l = sorted(l)
print(l[2] - l[0])


import random
import sys
import os

def solve(x, y, z):
	a = min(x, min(y, z))
	c = max(x, max(y, z))
	b = x + y + z - a - c
	ans = abs(b - a) + abs(b - c)
	return ans
rs = input().split(' ')
x = int(rs[0])
y = int(rs[1])
z = int(rs[2])
print(solve(x, y, z))


x = list(map(int, input().split()))
print(max(x) - min(x))


A = list(map(int, input().split()))
A.sort()
print(abs(A[1] - A[0]) + abs(A[1] - A[2]))


import re
s = input()
nums = [int(i) for i in re.findall('\\d+', s)]
nums.sort(reverse=True)
sumstep = nums[0] - nums[2]
print(sumstep)


l = list(map(int, input().strip().split()))
x = max(l) - min(l)
print(x)


import sys
ints = [int(i) for i in sys.stdin.readline().strip().split()]
ans = sum([abs(a - 1) for a in ints])
for i in range(2, 100 + 1):
	ans = min(ans, sum([abs(a - i) for a in ints]))
print(ans)


(a, b, c) = input().split(' ')
a = int(a)
b = int(b)
c = int(c)
x = abs(a - b) + abs(a - c)
y = abs(b - a) + abs(b - c)
z = abs(c - a) + abs(c - b)
print(min(x, min(y, z)))


n = list(map(int, input().split()))
n.sort()
x = n[1] - n[0]
y = n[2] - n[1]
print(x + y)


l = list(map(int, input().split()))
l = sorted(l)
print(l[2] - l[0])


x = list(map(int, input().split()))
x.sort()
print(abs(x[2] - x[0]))


(a, b, c) = sorted(map(int, input().split()))
print(abs(a - b + (b - c)))


a = list(map(int, input().split()))
a = sorted(a)
mn = a[2] - a[0]
print(mn)


nums = input().split()
nums = [int(c) for c in nums]
nums = sorted(nums)
print(nums[-1] - nums[0])


def main():
	n = [int(i) for i in input().split()]
	print(max(n) - min(n))
main()


def main():
	[x, y, z] = sorted([int(a) for a in input().split()])
	print(z - x)
main()


lst = list(map(int, input().split()))
lst.sort()
(a, b, c) = (lst[0], lst[1], lst[2])
print(min(b - a + (c - a), b - a + (c - b), c - a + (c - b)))


num = list(map(int, input().split()))
num.sort()
print(num[2] - num[0])


a = list(map(int, input().split()))
a.sort()
print(int(abs(a[0] - a[1]) + abs(a[1] - a[2])))


points = tuple(map(int, input().split()))
print(max(points) - min(points))


a = list(map(int, input().split()))
a = sorted(a)
x = a[1] - a[0]
y = a[2] - a[1]
print(x + y)


def func(n):
	n.sort()
	distance = 0
	distance += n[1] - n[0]
	distance += n[2] - n[1]
	print(distance)
n = list(map(int, input().split()))
func(n)


coordinates = list(map(int, input().split()))
sortedCoordinates = sorted(coordinates)
print((sortedCoordinates[0] - sortedCoordinates[1]).__abs__() + (sortedCoordinates[2] - sortedCoordinates[1]).__abs__())


(x, y, w) = sorted(map(int, input().split()))
s = y - x
n = w - y
print(s + n)


import sys
a = sys.stdin.readline().split(' ')
a = sorted([int(x) for x in a])
print(a[-1] - a[0])


(k, l, m) = [int(k) for k in input().split()]
arr = []
arr.append(k)
arr.append(l)
arr.append(m)
arr.sort()
t = arr[2] - arr[1]
d = arr[1] - arr[0]
print(t + d)


ns = sorted(list(map(int, input().split())))
print(ns[2] - ns[0])


(a, _, c) = sorted(map(int, input().split()))
print(c - a)


from statistics import mean
b = list(map(int, input().split()))
b.sort()
count = 0
count += abs(b[0] - b[1])
count += abs(b[2] - b[1])
print(count)


(x1, x2, x3) = map(int, input().split())
x = sorted([x1, x2, x3])
print(x[1] - x[0] + (x[2] - x[1]))


x = input().split()
emon = []
for i in x:
	c = int(i)
	emon.append(c)
emon.sort()
a = emon[0]
b = emon[1]
c = emon[2]
sum = b - a
sum = sum + (c - b)
print(sum)


a = [int(i) for i in input().split()]
a = sorted(a)
print(a[-1] - a[0])


l = [int(i) for i in input().split()]
l.sort()
maxx = max(l)
for i in range(0, len(l)):
	summ = 0
	for j in range(0, len(l)):
		summ = summ + abs(l[i] - l[j])
	maxx = min(maxx, summ)
print(maxx)


x = sorted(map(int, input().split()))
print(max(x) - min(x))


from sys import stdin, stdout

def rint():
	return map(int, stdin.readline().split())
a = list(rint())
a.sort()
print(a[2] - a[0])


from math import inf
(a, b, c) = list(map(int, input().split()))
mini = inf
for i in range(1, max(a, b, c)):
	mini = min(abs(a - i) + abs(b - i) + abs(c - i), mini)
print(mini)


(x1, x2, x3) = map(int, input().split())
lst = []
lst.append(x1)
lst.append(x2)
lst.append(x3)
lst.sort()
s = abs(lst[0] - lst[1])
a = abs(lst[1] - lst[2])
b = abs(lst[0] - lst[2])
m = min(s, b)
print(a + m)


a = list(map(int, input().split()))
a.sort()
c = a[1]
d = 0
for i in a:
	d += abs(i - c)
print(d)


omer = 0
qwerty = [int(i) for i in input().split()]
while omer < len(qwerty):
	plusiki = omer
	bigestnumber = omer
	while plusiki < len(qwerty):
		if qwerty[plusiki] < qwerty[bigestnumber]:
			bigestnumber = plusiki
		plusiki = plusiki + 1
	(qwerty[omer], qwerty[bigestnumber]) = (qwerty[bigestnumber], qwerty[omer])
	omer = omer + 1
print(qwerty[2] - qwerty[0])


arr = list(map(int, input().split()))
print(max(arr) - min(arr))


import re
s = input()
r = re.findall('\\d+', s)
r = [int(i) for i in r]
r.sort()
print(int(r[2]) - int(r[0]))


def main():
	x = list(map(int, input().split()))
	x.sort()
	point = x[1]
	print(sum([abs(point - i) for i in x]))
main()


lst = list(map(int, input().split()))
m = max(lst)
n = min(lst)
print(m - n)


a = list(map(int, input().split()))
a.sort()
a1 = a[1] - a[0]
a2 = a[2] - a[1]
print(a1 + a2)


array = list(map(int, input().split()))
output = max(array) - min(array)
print(output)


a = [int(i) for i in input().split()]
a.sort()
c = a[1] - a[0] + a[2] - a[1]
print(c)


houses = list(map(int, input().strip().split()))
print(max(houses) - min(houses))


nums = [int(i) for i in input().split()]
nums.sort()
m = nums[len(nums) // 2]
r = sum(map(lambda n: abs(m - n), nums))
print(r)


X = sorted(list(map(int, input().split())))
print(X[-1] - X[0])


(a, b, c) = sorted([int(x) for x in input().split()])
print(c - a)


(x1, x2, x3) = map(int, input().split())
mins = abs(x2 - x1) + abs(x3 - x2)
for i in range(max(x1, x2, x3) + 1):
	mins = min(mins, abs(x1 - i) + abs(x2 - i) + abs(x3 - i))
print(mins)


coor = [int(i) for i in input().split(' ')]
(x1, x2, x3) = sorted(coor)
print(x3 - x1)


coords = [int(n) for n in input().split()]
coords.sort()
print(coords[2] - coords[0])


(x, y, z) = map(int, input().split())
min = min(x, y, z)
max = max(x, y, z)
mid = x + y + z - (min + max)
d1 = max - mid
d2 = mid - min
t = d1 + d2
print(t)


s = input().split()
for i in range(len(s)):
	s[i] = int(s[i])
s.sort()
print(s[2] - s[1] + s[1] - s[0])


from math import ceil
l = [int(x) for x in input().split()]
k = ceil(sum(l) / 3)
res = 10 ** 4
for k in range(1, 101):
	res = min(sum([abs(l[i] - k) for i in range(3)]), res)
print(res)


import math
import sys
input = sys.stdin.readline

def invr():
	return list(map(int, input().split()))
x = invr()
x.sort()
print(x[1] - x[0] + (x[2] - x[1]))


def distance(a):
	for i in range(0, 3):
		for j in range(0, 3):
			if a[i] < a[j]:
				t = a[i]
				a[i] = a[j]
				a[j] = t
	res = a[1] - a[0] + (a[2] - a[1])
	print(res)
list1 = [int(n) for n in input().split()]
distance(list1)


ai = [int(i) for i in input().split(' ')]
ai = sorted(ai)
print(ai[1] - ai[0] + (ai[2] - ai[1]))


n = input()
n = n.split()
n[0] = int(n[0])
n[1] = int(n[1])
n[2] = int(n[2])
n.sort()
print(-n[0] + n[2])


houses = list(map(int, input().strip().split()))
houses.sort()
print(houses[1] - houses[0] + (houses[2] - houses[1]))


input = input()
input = str(input)
coordinateList = input.split(' ')
length = len(coordinateList)
coordinateList = [int(i) for i in coordinateList]
coordinateList.sort()
meeting_coordinate = coordinateList[length // 2]
res = 0
for i in coordinateList:
	res += abs(int(i) - int(meeting_coordinate))
print(res)


(x, y, z) = map(int, input().split())
l = []
l.append(x)
l.append(y)
l.append(z)
l.sort()
a = abs(x - l[1])
b = abs(y - l[1])
c = abs(z - l[1])
print(a + b + c)


from sys import stdin, stdout
coordinates = sorted(list(map(int, stdin.readline().split())))
stdout.write(str(coordinates[-1] - coordinates[0]))


(x, y, z) = map(int, input().split())
mx = max(x, y, z)
mn = min(x, y, z)
print(mx - mn)


(x1, x2, x3) = sorted(map(int, input().split()))
print(abs(x3 - x2) + abs(x2 - x1))


dots = sorted([int(i) for i in input().split()])
print(dots[2] - dots[0])


arr = sorted([int(i) for i in input().split()])
print(arr[1] - arr[0] + (arr[2] - arr[1]))


(x1, x2, x3) = map(int, input().split(' '))
min_dist = 1000
for x in range(101):
	min_dist = min(min_dist, abs(x - x1) + abs(x - x2) + abs(x - x3))
print(min_dist)


x = [int(i) for i in input().split()]
x.sort()
s = abs(x[0] - x[1]) + abs(x[2] - x[1])
print(s)


n = list(map(int, input().split()))
a = sorted(n)
f = a[1] - a[0] + a[2] - a[1]
print(f)


k = list(map(int, input().split()))
k.sort()
c = k[1] - k[0]
c = c + (k[2] - k[1])
print(c)


a = [int(x) for x in input().split(' ')]
a.sort()
dist = a[2] - a[0]
print(dist)


(x1, x2, x3) = map(int, input().split())
a = 0
if x1 > x2:
	if x2 > x3:
		a = x2
	if x2 < x3:
		if x1 > x3:
			a = x3
		if x1 < x3:
			a = x1
else:
	if x2 < x3:
		a = x2
	if x2 > x3:
		if x1 > x3:
			a = x1
		if x1 < x3:
			a = x3
print(abs(x1 - a) + abs(x2 - a) + abs(x3 - a))


n = sorted(list(map(int, input().split())))
print(n[2] - n[0])


values = input()
(a, b, c) = values.split()
a = int(a)
b = int(b)
c = int(c)
diff1 = abs(a - b)
diff2 = abs(b - c)
diff3 = abs(a - c)
print(min(diff1 + diff2, diff1 + diff3, diff2 + diff3))


word = str(input())
word = word.split(' ')
n = 0
while n < len(word) - 1:
	if int(word[n]) > int(word[n + 1]):
		(word[n], word[n + 1]) = (word[n + 1], word[n])
		n = 0
	else:
		n += 1
num1 = int(word[0])
num2 = int(word[1])
num3 = int(word[2])
print(num3 - num2 + (num2 - num1))


a = [int(i) for i in str(input()).split()]
print(max(a) - min(a))


points = [int(i) for i in input().split()]
print(max(points) - min(points))


l = list(map(int, input().split()))
l.sort()
print(abs(l[1] - l[0]) + abs(l[1] - l[2]))


(x1, x2, x3) = map(int, input().split())
if x1 > x2:
	(x1, x2) = (x2, x1)
if x1 > x3:
	(x1, x3) = (x3, x1)
if x2 > x3:
	(x2, x3) = (x3, x2)
mn = x3 - x1
for i in range(x1, x3):
	if abs(x1 - i) + abs(x2 - i) + abs(x3 - i) < mn:
		mn = abs(x1 - i) + abs(x2 - i) + abs(x3 - i)
print(mn)


dis = list(map(int, input().split()))
x = min(dis)
dis.remove(x)
y = max(dis)
dis.remove(y)
print(y - dis[0] + (dis[0] - x))


def main():
	(a, b, c) = map(int, input().split())
	print(str(max(a, b, c) - min(a, b, c)) + '\n')
	return 0
main()


l = [int(k) for k in input().split(' ')]
(x1, x2, x3) = (l[0], l[1], l[2])
print(max(x1, x2, x3) - min(x1, x2, x3))


import sys
(a, b, c) = map(int, sys.stdin.readline().split())
ma = max(a, b, c)
mi = min(a, b, c)
print(ma - mi)


a = list(map(int, input().split()))
a.sort()
b = a[1] - a[0]
c = a[2] - a[1]
d = b + c
print(d)


L = [int(x) for x in input().split()]
print(max(L) - min(L))


a = list(map(int, input().split()))
a.sort()
a = a[2] - a[0]
print(a)


string = input()
l = string.split()
for i in range(3):
	l[i] = int(l[i])
l.sort()
print(l[2] - l[1] + (l[1] - l[0]))


(a, b, c) = map(int, input().split())
l = []
l.append(a)
l.append(b)
l.append(c)
l.sort()
print(abs(l[1] - l[0]) + abs(l[1] - l[2]))


inp = input('').split()
li = []
for i in inp:
	li.append(int(i))
li.sort()
print(li[2] - li[0])


y = list(map(int, input().split()))
y.sort()
print(y[2] - y[1] + (y[1] - y[0]))


(x1, x2, x3) = map(int, input().split())
array = [x1, x2, x3]
array.sort()
print(array[2] - array[0])


n = list(map(int, input().split()))
a = max(n)
b = min(n)
c = a - b
print(c)


a = [int(i) for i in input().split()]
val1 = abs(a[0] - a[1]) + abs(a[0] - a[2])
val2 = abs(a[0] - a[1]) + abs(a[1] - a[2])
val3 = abs(a[0] - a[2]) + abs(a[2] - a[1])
print(min(val1, val2, val3))


import sys
from random import choice, randint
inp = sys.stdin.readline
out = sys.stdout.write
flsh = sys.stdout.flush
sys.setrecursionlimit(10 ** 9)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def MI():
	return map(int, inp().strip().split())

def LI():
	return list(map(int, inp().strip().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]

def LI_():
	return [int(x) - 1 for x in inp().strip().split()]

def LF():
	return [float(x) for x in inp().strip().split()]

def LS():
	return inp().strip().split()

def I():
	return int(inp().strip())

def F():
	return float(inp().strip())

def S():
	return inp().strip()

def pf(s):
	return out(s + '\n')

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	(a, b, c) = MI()
	l = [a, b, c]
	l.sort()
	ans = l[1] - l[0] + l[2] - l[1]
	pf(str(ans))
main()


li = [int(i) for i in input().split()]
li.sort()
print(abs(li[0] - li[1]) + abs(li[2] - li[1]))


x = list(map(int, input().strip().split(' ')))
result = []
maxi = max(x)
for i in range(3):
	res = []
	res = list(filter(lambda a: a != x[i], x))
	result = []
	result.append(abs(res[0] - x[i]))
	result.append(abs(res[1] - x[i]))
	if sum(result) < maxi:
		maxi = sum(result)
print(maxi)


L = sorted([int(x) for x in input().split()])
print(L[2] - L[0])


x = [int(a) for a in input().split()]
x.sort()
print(abs(x[1] - x[0]) + abs(x[1] - x[2]))


houses = [int(i) for i in input().split(' ')]
bestTravel = 10000
point = 1
while point <= 100:
	travel = 0
	for h in houses:
		travel += abs(point - h)
	if travel < bestTravel:
		bestTravel = travel
	point += 1
print(bestTravel)


(x1, x2, x3) = [int(i) for i in input().split()]
print(min(abs(x1 - x2) + abs(x1 - x3), abs(x2 - x1) + abs(x2 - x3), abs(x3 - x1) + abs(x3 - x2)))


list1 = [int(i) for i in input().split(' ')]
list1.sort()
a = list1[0]
b = list1[1]
c = list1[2]
total = c - b + b - a
print(total)


from sys import stdin
(a, b, c) = sorted(map(int, stdin.readline().split()))
q = c - a
print(q)


x = [int(x) for x in input().split()]
x.sort()
y = x[2] - x[1] + (x[1] - x[0])
print(y)


x = list(map(int, input().split()))
x1 = max(x)
x2 = min(x)
x3 = (x1 + x2) // len(x)
res = x1 - x3 + (x3 - x2)
print(res)


arr = list(map(int, input().split()))
s = sorted(arr)
print(s[1] - s[0] + s[2] - s[1])


friends = list(map(int, input().split()))
friends.sort()
way = friends[1] - friends[0] + friends[2] - friends[1]
print(way)


(x1, x2, x3) = map(int, input().split())
mas = [x1, x2, x3]
mas.sort()
print(mas[2] - mas[0])


w = list(map(int, input().split()))
print(max(w) - min(w))


(a, b, c) = map(int, input().split())
l = [a, b, c]
l.sort()
d1 = l[1] - l[0]
d2 = l[2] - l[1]
print(d1 + d2)


l = list(map(int, input().split()))
l.sort()
s = l[0]
e = l[-1]
mi = 300
for i in range(s, e + 1):
	mi = min(abs(i - l[0]) + abs(i - l[1]) + abs(i - l[2]), mi)
print(mi)


(x1, x2, x3) = [int(x1) for x1 in input().split(' ')]
m = max(x1, x2, x3)
mi = min(x1, x2, x3)
print(m - mi)


a = [int(i) for i in input().split()]
x = a[0]
y = a[1]
z = a[2]

def xxx(x):
	if x < 0:
		x *= -1
	return x
b = 99999999999999999999
for i in range(min(a), max(a) + 1):
	c = xxx(x - i) + xxx(y - i) + xxx(z - i)
	if c < b:
		b = c
print(b)


(a, b, c) = list(map(int, input().split()))
l = []
l.append(a)
l.append(b)
l.append(c)
l.sort()
cmp = l[1]
sum = 0
sum += l[2] - cmp
sum += cmp - l[0]
print(sum)


coords = sorted(list(map(int, input().split())))
print(coords[2] - coords[0])


(a, b, c) = input().split()
a = int(a)
b = int(b)
c = int(c)
maxi = max(a, b, c)
mini = min(a, b, c)
least = 1000000
for i in range(mini, maxi, +1):
	total = abs(i - a) + abs(i - b) + abs(i - c)
	if total < least:
		least = total
print(least)


l = list(map(int, input().split()))
print(max(l) - min(l))


(a, b, c) = map(int, input().split())
l = [a, b, c]
l = [abs(i - a) + abs(i - b) + abs(i - c) for i in range(max(l))]
print(min(l))


l = list(map(int, input().split()))
l.sort()
x1 = l[1] - l[0]
x2 = l[2] - l[1]
print(x1 + x2)


coordinates = input().split()
for i in range(len(coordinates)):
	coordinates[i] = int(coordinates[i])
sortedCoordinates = sorted(coordinates)
ans = sortedCoordinates[2] - sortedCoordinates[1] + sortedCoordinates[1] - sortedCoordinates[0]
print(ans)


from sys import stdin

def main():
	f = [int(x) for x in stdin.readline().split(' ')]
	z = abs(f[1] - f[0]) + abs(f[2] - f[0])
	o = abs(f[0] - f[1]) + abs(f[2] - f[1])
	t = abs(f[0] - f[2]) + abs(f[1] - f[2])
	print(min(z, o, t))
main()


a = sorted([int(x) for x in input().split()])
print(a[2] - a[0])


(a, b, c) = [int(x) for x in input().split()]
ans = 999999999
for i in range(max(a, b, c)):
	ans = min(ans, abs(a - i) + abs(b - i) + abs(c - i))
print(ans)


tab = list(map(int, input().split()))
tab.sort()
print(tab[1] - tab[0] + (tab[2] - tab[1]))


ar = []
for i in input().split(' '):
	ar.append(int(i))
ar.sort()
print(ar[2] - ar[0])


l = sorted(list(map(int, input().split())))
a = l[1]
print(a - l[0] + l[2] - a)


t = []
n = input()
s = n.split()
for san in s:
	t.append(int(san))
t.sort()
t1 = 2 * t[2] - t[1] - t[0]
t2 = t[2] - t[0]
if t1 > t2:
	print(t2)
else:
	print(t1)


x = [int(i) for i in input().split()]
co1 = max(x)
x.remove(co1)
co2 = min(x)
x.remove(co2)
meet = 0
meet = meet + (x[0] - co2)
meet = meet + (co1 - x[0])
print(meet)


(x1, x2, x3) = [int(x) for x in input().split()]
print(min(abs(x1 - x2) + abs(x1 - x3), abs(x1 - x2) + abs(x3 - x2), abs(x1 - x3) + abs(x2 - x3)))


(f1, f2, f3) = input().split()
f1 = int(f1)
f2 = int(f2)
f3 = int(f3)
d1 = abs(int(abs(f2 - f1) + abs(f3 - f1)))
d2 = abs(int(abs(f1 - f2) + abs(f3 - f2)))
d3 = abs(int(abs(f1 - f3) + abs(f2 - f3)))
if d1 < d2 and d1 < d3:
	print(d1)
elif d2 < d3 and d2 < d1:
	print(d2)
elif d3 < d1 and d3 < d2:
	print(d3)


arr = list(map(int, input().split()))
ma = max(arr)
mi = min(arr)
for i in arr:
	if i != ma and i != min:
		z = i
s = 0
s = ma - z + (z - mi)
print(s)


lista = list(map(int, input().split()))
x1 = max(lista)
M = lista.index(x1)
lista.pop(M)
x2 = max(lista)
N = lista.index(x2)
lista.pop(N)
x3 = lista[0]
S = abs(x1 - x2) + abs(x3 - x2)
print(int(S))


arr = list(map(int, input().split()))
arr = sorted(list(set(arr)))
print(arr[1] - arr[0] + arr[2] - arr[1])


(x1, x2, x3) = map(int, input().split(' '))
m = 1000
for x in range(1, 101):
	mm = abs(x1 - x) + abs(x2 - x) + abs(x3 - x)
	m = min(m, mm)
print(m)


l1 = []
l1 = input().split(' ')
l1 = [int(i) for i in l1]
l1 = sorted(l1)
print(l1[-1] - l1[0])


Localstrlist = input().split()
Localnumlist = [int(i) for i in Localstrlist]
(Maxplace, Minplace) = (max(Localnumlist), min(Localnumlist))
DistanceList = []
for place in range(Minplace, Maxplace + 1):
	Distance = abs(place - Localnumlist[0]) + abs(place - Localnumlist[1]) + abs(place - Localnumlist[2])
	DistanceList.append((Distance, place))
DistanceList.sort(key=lambda x: x[0])
print(DistanceList[0][0])


from collections import defaultdict
import sys, os, math
x = list(map(int, input().split()))
ans = 300
for i in range(min(x), max(x) + 1):
	tmp = abs(i - x[0]) + abs(i - x[1]) + abs(i - x[2])
	if tmp < ans:
		ans = tmp
print(ans)


(x, y, z) = map(int, input().split())
a = [x, y, z]
a.sort()
dist = 0
b = a[1]
for i in a:
	dist += abs(b - i)
print(dist)


def f(a, b):
	return a - b if a - b > 0 else -(a - b)
(a, b, c) = [int(i) for i in input().split()]
print(min(f(a, b) + f(c, b), f(b, a) + f(c, a), f(a, c) + f(b, c)))


x = list(map(int, input().split()))
x.sort()
print(x[-1] - x[0])


(x, y, z) = input().split()
x = int(x)
y = int(y)
z = int(z)
start = min(x, y, z)
finish = max(x, y, z)
print(-start + finish)


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0)
(a, b, c) = get_ints()
print(max(a, b, c) - min(a, b, c))


l = list(map(int, input().split()))
n = len(l)
l.sort()
m = l[1]
s = 0
for i in range(n):
	s += abs(m - l[i])
print(s)


L = sorted(list(map(int, input().split())))
print(L[2] - L[0])


from sys import stdin
i = sorted([int(x) for x in stdin.readline().rstrip().split()])
print(i[-1] - i[0])


a = list(map(int, input().split()))
ans = 10010010
for i in range(min(a), max(a) + 1):
	sum = 0
	for el in a:
		sum += abs(el - i)
	ans = min(ans, sum)
print(ans)


li = sorted(list(map(int, input().split())))
l = len(li)
li_m = []
for i in range(l):
	m1 = 0
	for j in range(i + 1, l):
		m1 += li[j] - li[i]
	for k in range(i):
		m1 += li[i] - li[k]
	li_m.append(m1)
print(min(li_m))


(a, b, c) = map(int, input().split())
d = max(a, b, c)
e = min(a, b, c)
f = a + b + c - d - e
print(d - f + (f - e))


t = [int(x) for x in input().split()]
print(max(t) - min(t))


(x, y, z) = map(int, input().split())
list = [x, y, z]
list.sort()
print(list[2] - list[0])


inp = input().split()
total = 0
for x in range(3):
	inp[x] = int(inp[x])
inp = sorted(inp)
total += abs(inp[1] - inp[0])
total += abs(inp[2] - inp[1])
print(total)


n = [int(x) for x in input().split()]
print(max(n) - min(n))


(a, b, c) = map(int, input().split(' '))
list1 = [a, b, c]
list1.sort()
print(list1[1] - list1[0] + list1[2] - list1[1])


x = list(map(int, input().split()))
x.sort()
a = 0
a = x[1] - x[0]
a += x[2] - x[1]
print(a)


l = input().split()
l = [int(m) for m in l]
l.sort()
print(int(l[2]) - int(l[0]))


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_int = lambda : int(sys.stdin.readline().strip())
pt = lambda x: sys.stdout.write(str(x))
(a, b, c) = get_list()
lst = [0, 0, 0]
lst[0] = abs(b - a) + abs(c - a)
lst[1] = abs(a - b) + abs(c - b)
lst[2] = abs(b - c) + abs(a - c)
print(min(lst))


data = [int(info) for info in input().split(' ')]
mid = data[0]
ma = max(data)
mi = min(data)
for i in data:
	if i < ma and i > mi:
		mid = i
print(ma - mid + (mid - mi))


arr = [int(x) for x in input().split()]
m = sorted(arr)[1]
sum = 0
for i in arr:
	sum += abs(m - i)
print(sum)


[x1, x2, x3] = [int(i) for i in input().split()]
ans = abs(x2 - x1) + abs(x3 - x1)
for x in range(1, max(x1, x2, x3) + 1):
	ans = min(abs(x1 - x) + abs(x2 - x) + abs(x3 - x), ans)
print(ans)


(a, b, c) = map(int, input().split())
k = [a, b, c]
k.sort()
q = int((a + b + c) / 3)
z_ = []
for r in range(1, k[2]):
	z = abs(a - r) + abs(b - r) + abs(c - r)
	z_.append(z)
z_.sort()
print(z_[0])


l = list(map(int, input().split()))
a = max(l)
b = min(l)
print(a - b)


points = list(map(int, input().split()))
for i in range(len(points) - 1):
	for j in range(len(points) - 1):
		if points[j] > points[j + 1]:
			(points[j], points[j + 1]) = (points[j + 1], points[j])
print(points[1] - points[0] + (points[2] - points[1]))


(a, b, c) = list(map(int, input().split()))
mini = 10 ** 9
mini = min(abs(a - c) + abs(b - c), mini)
mini = min(abs(b - a) + abs(b - c), mini)
mini = min(abs(b - a) + abs(c - a), mini)
print(mini)


(x1, x2, x3) = map(int, input().split())
mini = min(x1, x2, x3)
maxi = max(x1, x2, x3)
print(maxi - mini)


str = input()
str = str.split()
x1 = int(str[0])
x2 = int(str[1])
x3 = int(str[2])
mini = 99999999
for i in range(1, 101):
	mini = min(mini, abs(x1 - i) + abs(x2 - i) + abs(x3 - i))
print(mini)


def new_year(lst):
	a = sorted(lst)
	return a[2] - a[0]
b = [int(i) for i in input().split()]
print(new_year(b))


mas = list(map(int, input().split()))
m1 = [0, 1, 2]
m1.remove(mas.index(max(mas)))
m1.remove(mas.index(min(mas)))
print(max(mas) - mas[m1[0]] + mas[m1[0]] - min(mas))


l = list(map(int, input().split()))
a = sorted(l)[0]
b = sorted(l)[-1]
print(b - a)


houses = [int(x) for x in input().split()]
houses.sort()
res = houses[2] - houses[1] + (houses[1] - houses[0])
print(res)


a = sorted(list(map(int, input().split())))
print(min(a[1] - a[0] + a[2] - a[0], a[2] - a[0], a[2] - a[1] + a[2] - a[0]))


from sys import stdin

def main():
	lista = [int(x) for x in stdin.readline().strip().split()]
	while lista != []:
		(x1, x2, x3) = (lista[0], lista[1], lista[2])
		oper1 = abs(x1 - x2) + abs(x1 - x3)
		oper2 = abs(x2 - x3) + abs(x2 - x1)
		oper3 = abs(x3 - x1) + abs(x3 - x2)
		if oper1 < oper2 and oper1 < oper3:
			print(oper1)
		elif oper2 < oper1 and oper2 < oper3:
			print(oper2)
		elif oper3 < oper1 and oper3 < oper2:
			print(oper3)
		lista = [int(x) for x in stdin.readline().strip().split()]
main()


(a, b, c) = [int(i) for i in input().split()]
max = max([a, b, c])
min = min([a, b, c])
if a != max and a != min:
	print(abs(a - max) + abs(a - min))
elif b != max and b != min:
	print(abs(b - max) + abs(b - min))
else:
	print(abs(c - max) + abs(c - min))


a = list(map(int, input().split()))
a.sort(reverse=True)
print(a[0] - a[1] + (a[1] - a[2]))


(a, b, c) = map(int, input().split())
sr = a + b + c - (min(a, b, c) + max(a, b, c))
print(max(a, b, c) - sr + (sr - min(a, b, c)))


abc = list(map(int, input().split(' ')))
a = int(abc[0])
b = int(abc[1])
c = int(abc[2])
max = max(abc)
min = min(abc)
s = a
if b < max and b > min:
	s = b
elif c < max and c > min:
	s = c
print(str(abs(a - s) + abs(b - s) + abs(c - s)))


(a, b, c) = [int(x) for x in input().split()]
p = abs(a - b) + abs(a - c)
q = abs(b - c) + abs(b - a)
t = abs(c - a) + abs(c - b)
print(min(p, q, t))


l = list(map(int, input().split(' ')))
l.sort()
if l[2] - l[1] >= l[1] - l[0]:
	d = l[2] - l[0]
elif l[1] - l[0] > l[2] - l[1]:
	d = l[2] - l[0]
print(d)


x = [int(i) for i in input().split()]
if x[2] > x[0] > x[1] or x[1] > x[0] > x[2]:
	print(abs(x[2] - x[0]) + abs(x[1] - x[0]))
elif x[2] > x[1] > x[0] or x[0] > x[1] > x[2]:
	print(abs(x[2] - x[1]) + abs(x[0] - x[1]))
else:
	print(abs(x[0] - x[2]) + abs(x[1] - x[2]))


street = list(map(int, input().split()))
street.sort()
print(-street[0] + street[2])


(a, b, c) = list(map(int, input().split()))
x = []
x.append(abs(a - b) + abs(a - c))
x.append(abs(b - a) + abs(b - c))
x.append(abs(c - a) + abs(c - b))
print(min(x))


(a, b, c) = map(int, input().split())

def maximum(a, b, c):
	return max(max(a, b), c)

def minimum(a, b, c):
	return min(min(a, b), c)
print(maximum(a, b, c) - minimum(a, b, c))


location = input().split()
for i in range(len(location)):
	location[i] = int(location[i])
ans = max(location) - min(location)
print(ans)


(x1, x2, x3) = list(map(int, input().split()))
l = []
l.append(abs(x1 - x2))
l.append(abs(x1 - x3))
l.append(abs(x2 - x3))
c = 0
c = c + min(l)
l.remove(c)
c = c + min(l)
print(c)


s = list(map(int, input().split()))
a = max(s)
l = []
for i in s:
	l.append(a - i)
print(max(l))


def distance():
	arr = list(map(int, input().split()))
	x = max(arr)
	y = min(arr)
	print(x - y)
distance()


(a, b, c) = input().split()
a = int(a)
b = int(b)
c = int(c)
print(max(a, b, c) - min(a, c, b))


li = sorted(list(map(int, input().split())))
print(li[-1] - li[0])


import math

def BuubleSort(a, b, c):
	l = [a, b, c]
	l.sort()
	return l[1] - l[0] + l[2] - l[1]

def main():
	(a, b, c) = map(int, input().split())
	ans = BuubleSort(a, b, c)
	print(ans)
main()


n = list(map(int, input().split()))
n.sort()
print(-n[0] + n[2])


num = sorted([int(i) for i in input().split()])
s = 0
s = abs(num[0] - num[1]) + abs(num[1] - num[2])
print(s)


(*n,) = map(int, input().split())
print(max(n) - min(n))


l = sorted([int(x) for x in input().split()])
print(l[2] - l[0])


def main():
	x = list(map(int, input().split()))
	x.sort()
	print(x[-1] - x[0])
main()


nums = [int(i) for i in input().split()]
print(max(nums) - min(nums))


(a, b, c) = map(int, input().split())
n = max(a, b, c)
s = 0
ans = 1000
for i in range(1, n + 1):
	s = abs(i - a) + abs(i - b) + abs(i - c)
	if s < ans:
		ans = s
print(ans)


(a, b, c) = map(int, input().split())
v = max(a, b, c)
z = min(a, b, c)
print(v - z)


lst = list(map(int, input().split()))
lst.sort()
print(lst[1] - lst[0] + (lst[2] - lst[1]))


a = list(map(int, input().split()))
a.sort()
k = a[1] - a[0]
k = k + a[2] - a[1]
print(k)


num = input()
arr = []
count = 0
for i in range(0, len(num)):
	if num[i] == ' ':
		arr.append(int(num[count:i]))
		count = i + 1
	elif i == len(num) - 1:
		arr.append(int(num[count:len(num)]))
arr.sort()
distance = arr[1] - arr[0] + (arr[2] - arr[1])
print(distance)


a = list(map(int, input().split()))
A = max(a) - min(a)
print(A)


(x1, x2, x3) = map(int, input().split())
if x1 <= x2 and x1 >= x3:
	print(x2 - x1 + (x1 - x3))
elif x1 >= x2 and x1 <= x3:
	print(x1 - x2 + (x3 - x1))
elif x2 <= x1 and x2 >= x3:
	print(x1 - x2 + (x2 - x3))
elif x2 >= x1 and x2 <= x3:
	print(x2 - x1 + (x3 - x2))
elif x3 <= x1 and x3 >= x2:
	print(x1 - x3 + (x3 - x2))
else:
	print(x3 - x1 + (x2 - x3))


x = sorted([int(i) for i in input().split()])
print(abs(x[1] - x[0]) + abs(x[1] - x[2]))


a = input().split()
x1 = int(a[0])
x2 = int(a[1])
x3 = int(a[2])
if x1 > x2:
	if x3 > x1:
		z = x1
	elif x2 > x3:
		z = x2
	else:
		z = x3
elif x3 > x2:
	z = x2
elif x1 > x3:
	z = x1
else:
	z = x3
print(abs(z - x1) + abs(z - x2) + abs(z - x3))


def ms(v):
	v.sort()
	(q, z, w) = v
	m = 100
	for x in range(q, w + 1):
		t = abs(q - x) + abs(z - x) + abs(w - x)
		if m > t:
			m = t
	return m
v = [int(x) for x in input().split()]
print(ms(v))


arr = map(int, input().split())
arr = sorted(arr)
print(arr[2] - arr[0])


l = list(map(int, input().split()))
l.sort()
n = len(l)
ans = 0
for i in range(1, n):
	ans += l[i] - l[i - 1]
print(ans)


a = [int(i) for i in input().split()]
a.sort(reverse=True)
print(a[0] - a[1] + a[1] - a[2])


n = input()
n1 = int(n.split()[0])
n2 = int(n.split()[1])
n3 = int(n.split()[2])
l = []
l.append(abs(n1 - n2) + abs(n1 - n3))
l.append(abs(n2 - n1) + abs(n2 - n3))
l.append(abs(n3 - n2) + abs(n3 - n1))
print(min(l))


x = sorted(list(map(int, input().split(' '))))
print(x[2] - x[0])


s = map(int, input().split())
l = sorted(list(s))
(a, b, c) = (int(l[0]), int(l[1]), int(l[2]))
m = (a + b + c) // 3
x = c - m + (m - a)
print(x)


(a1, a2, a3) = [int(x) for x in input().split()]
Dist = []
for n in range(101):
	d1 = abs(a1 - n)
	d2 = abs(a2 - n)
	d3 = abs(a3 - n)
	dist = d1 + d2 + d3
	Dist.append(dist)
print(min(Dist))


listt = [int(i) for i in input().split()]
listt.sort()
print(listt[1] - listt[0] + listt[2] - listt[1])


data = [int(i) for i in input().split()]
data.sort()
box = data[2] - data[0]
print(box)


n = input()
d = []
for x in n.split(' '):
	d.append(int(x))
d = sorted(d)
s = d[1]
total = 0
total += d[1] - d[0]
total += d[2] - d[1]
print(total)


a = list(map(int, input().strip().split(' ')))
a = sorted(a)
d = a[2] - a[0]
print(d)


(x1, x2, x3) = map(int, input().split())
print(min(abs(x1 - x2) + abs(x1 - x3), abs(x2 - x1) + abs(x2 - x3), abs(x3 - x2) + abs(x3 - x1)))


(x1, x2, x3) = input().split()
x1 = int(x1)
x2 = int(x2)
x3 = int(x3)
if x2 > x1 and x2 < x3:
	print(x2 - x1 + (x3 - x2))
elif x2 < x1 and x2 > x3:
	print(x2 - x3 + (x1 - x2))
elif x1 > x2 and x1 < x3:
	print(x1 - x2 + (x3 - x1))
elif x1 < x2 and x1 > x3:
	print(x1 - x3 + (x2 - x1))
elif x3 > x2 and x3 < x1:
	print(x3 - x2 + (x1 - x3))
elif x3 < x2 and x3 > x1:
	print(x2 - x3 + (x3 - x1))


(x1, x2, x3) = map(int, input().split())
mx = max(x1, x2, x3)
mi = min(x1, x2, x3)
print(mx - mi)


first = list(map(int, input().split()))
first.sort()
print(first[1] - first[0] + first[2] - first[1])


a = sorted(map(int, input().split()))
print(a[-1] - a[0])


(x, y, z) = map(int, input().split())
sum1 = abs(x - y) + abs(x - z)
sum2 = abs(x - y) + abs(y - z)
sum3 = abs(x - z) + abs(y - z)
sum = min(sum1, sum2)
sum = min(sum, sum3)
print(sum)


n = list(map(int, input().split()))
n.sort()
treck = n[1] - n[0] + (n[2] - n[1])
print(treck)


inp = list(map(int, input().split()))
print(max(inp) - min(inp))


L = list(map(int, input().split()))
L.sort()
print(L[2] - L[0])


(a, b, c) = map(int, input().split())
m = 9999999
for i in range(1, 100):
	m = min(m, abs(a - i) + abs(b - i) + abs(c - i))
print(m)


from sys import stdin
import math
(o, t, e) = map(int, stdin.readline().rstrip().split(' '))
print(max(o, t, e) - min(o, t, e))


(a, b, c) = map(int, input().split())
L = [a, b, c]
m = max(L)
n = min(L)
print(m - n)


list = input().split(' ')
list = [int(x) for x in list]
a = max(list)
b = min(list)
print(a - b)


(i, j, k) = map(int, input().split(' '))
print(max(i, j, k) - min(i, j, k))


(x, y, z) = map(int, input().split())
m = [x, y, z]
m = sorted(m)
print(m[2] - m[0])


(a, b, c) = map(int, input().split(' '))
if a < b < c:
	k = c - b + (b - a)
	print(k)
elif b < a < c:
	k = c - a + (a - b)
	print(k)
elif a < c < b:
	k = b - c + (c - a)
	print(k)
elif c < b < a:
	k = a - b + (b - c)
	print(k)
elif c < a < b:
	k = b - a + (a - c)
	print(k)
elif b < c < a:
	k = a - c + (c - b)
	print(k)


k = list(map(int, input().split()))
maxi = max(k)
mini = min(k)
print(maxi - mini)


liste = [int(x) for x in input().split()]
print(max(liste) - min(liste))


l = [int(i) for i in input().split()]
l.sort()
print(l[2] - l[0])


a = list(map(int, input().split()))
a.sort()
if a[0] != a[1] != a[-1]:
	print(a[-1] - a[1] + abs(a[0] - a[1]))
elif a[0] == a[1] == a[2]:
	print(0)
else:
	print(a[-1] - a[1])


a = input().split()
x = int(a[0])
y = int(a[1])
z = int(a[2])
m = []
m.append(x)
m.append(y)
m.append(z)
lst = sorted(m)
r = lst[2] - lst[1] + (lst[2] - lst[0])
p = lst[2] - lst[1] + (lst[1] - lst[0])
w = lst[2] - lst[0] + (lst[1] - lst[0])
print(min(r, p, w))


N = input().split(' ')
n = []
for i in N:
	i = int(i)
	n.append(i)
mx = max(n)
mn = min(n)
print(mx - mn)


c = [int(c_temp) for c_temp in input().strip().split(' ')]
c = sorted(c)
print(c[2] - c[1] + (c[1] - c[0]))


points = map(int, input().split())
points = list(points)
faraway = max(points)
nearly = min(points)
meeting_point = faraway - nearly
print(meeting_point)


(a, b, c) = map(int, input().split())
(m1, m2, m3) = (min(a, b, c), 0, max(a, b, c))
if m1 == a and m3 == b or (m1 == b and m2 == a):
	m2 = c
elif m1 == a and m3 == c or (m1 == c and m3 == a):
	m2 = b
elif m1 == b and m3 == c or (m1 == c and m3 == b):
	m2 = a
print(m2 - m1 + (m3 - m2))


l = list(map(int, input().split()))[:3]
l.sort()
ans = l[2] - l[1] + (l[1] - l[0])
print(ans)


(x1, x2, x3) = [int(elem) for elem in input().split()]
print(min([abs(x1 - x2) + abs(x1 - x3), abs(x2 - x1) + abs(x2 - x3), abs(x3 - x1) + abs(x3 - x2)]))


(x1, x2, x3) = map(int, input().split())
a = abs(x2 - x1)
b = abs(x3 - x2)
c = abs(x1 - x3)
k = max(a, b, c)
if k == a:
	print(b + c)
elif k == b:
	print(a + c)
else:
	print(a + b)


ar = sorted(list(map(int, input().split())))
count = 0
for i in ar:
	count += abs(i - ar[1])
print(count)


l = list(input().split())
l = [int(i) for i in l]
a = max(l)
l.remove(max(l))
b = min(l)
l.remove(min(l))
c = l[0]
print(c - b - (c - a))


(a, b, c) = map(int, input().split())
distance = 100
for i in range(1, 101):
	distance = min(distance, abs(i - a) + abs(i - b) + abs(i - c))
print(distance)


(x1, x2, x3) = map(int, input().split())
road = [x1, x2, x3]
print(max(road) - min(road))


p = list(map(int, input().split()))
p.sort()
print(p[2] - p[0])


(x, y, z) = [int(i) for i in input().split()]
m = max(x, y, z)
n = min(x, y, z)
sr = x + y + z - m - n
path = abs(m - sr) + abs(n - sr)
print(path)


d = 0
x = [int(y) for y in input().split()]
x.sort()
for i in x:
	d += abs(i - x[1])
print(d)


a = list(map(int, input().split()))
min = a[0]
max = a[0]
j = 0
k = 0
num = 0
for i in range(3):
	if a[i] > max:
		max = a[i]
		j = i
	if a[i] < min:
		min = a[i]
		k = i
for i in range(3):
	if i == j or i == k:
		continue
	num = a[j] - a[i] + (a[i] - a[k])
print(num)


A = sorted(list(map(int, input().split())))
print(-A[0] + A[2])


line = str(input()).split()
line = [int(it) for it in line]
print(max(line) - min(line))


def mint(q):
	q.sort()
	return q[0]
q = [int(x) for x in input().split()]
q.sort()
(a, b, c) = (q[0], q[1], q[2])
p = []
for z in range(a, c + 1):
	p.append(abs(z - a) + abs(z - b) + abs(z - c))
print(mint(p))


(x, x1, x2) = map(int, input().split())
li = []
li.append(x1)
li.append(x)
li.append(x2)
li.sort()
a = li[1] - li[0]
b = li[2] - li[1]
print(a + b)


n = [int(i) for i in input().split()]
a = (max(n) + min(n)) // 2
c = 0
c += max(n) - a
c += a - min(n)
print(c)


a = [int(x) for x in input().split()]
a.sort()
h = a[0]
hv = a[1]
v = a[2]
i = hv - h
j = v - hv
print(i + j)


li = [int(x) for x in input().split()]
li.sort()
(a, b, c) = li
print(b - a + (c - b))


x = list(map(int, input().split()))
a = int(sum(x) / len(x))
min_d = 301
for a in range(1, 101):
	d = abs(x[0] - a) + abs(x[1] - a) + abs(x[2] - a)
	if d < min_d:
		min_d = d
print(min_d)


x = list(map(int, input().split()))
ans = 10 ** 10
for i in range(1, 101):
	dis = 0
	for j in range(3):
		dis += abs(x[j] - i)
	ans = min(ans, dis)
print(ans)


num = list(map(int, input().strip().split()))
num = sorted(num)
res = num[1] - num[0] + (num[2] - num[1])
print(res)


(a, b, c) = map(int, input().split())
if a > b and a > c:
	if b > c:
		print(a - b + (b - c))
	else:
		print(a - c + (c - b))
elif b > a and b > c:
	if a > c:
		print(b - a + (a - c))
	else:
		print(b - c + (c - a))
elif c > a and c > b:
	if a > b:
		print(c - a + (a - b))
	else:
		print(c - b + (b - a))


lista = list(map(int, input().split()))
a = max(lista)
b = min(lista)
k = a + b // 2
print(a - k + (k - b))


distance = list(map(int, input().split()))
print(max(distance) - min(distance))


(x1, x2, x3) = map(int, input().split())
l = [x1, x2, x3]
a = min(l)
c = max(l)
print(c - a)


l = list(map(int, input().split()))
l.sort()
re = l[1] - l[0] + (l[2] - l[1])
print(re)


n = input().split(' ')
l = []
for i in n:
	l.append(int(i))
print(max(l) - min(l))


def main():
	from sys import stdin, stdout
	(a, b, c) = stdin.readline().split()
	a = int(a)
	b = int(b)
	c = int(c)
	dist = abs(a - b) + abs(b - c)
	dist = min(dist, abs(a - b) + abs(a - c))
	dist = min(dist, abs(a - c) + abs(b - c))
	stdout.write(str(dist))
main()


import sys
import math
import bisect

def main():
	A = list(map(int, input().split()))
	A.sort()
	ans = 0
	for i in range(len(A)):
		ans += abs(A[i] - A[1])
	print(ans)
main()


A = list(map(int, input().split()))
A.sort()
ans = 1000000000000000000000
for i in range(A[0], A[2] + 1):
	ans = min(ans, abs(A[0] - i) + abs(A[1] - i) + abs(A[2] - i))
print(ans)


(a, b, c) = map(int, input().split())
maxx = max(max(a, b), c)
minn = min(min(a, b), c)
print(*[maxx - i + i - minn for i in (a, b, c) if i != maxx and i != minn])


l = sorted(list(map(int, input().split())))
p = l[len(l) // 2]
sh = 0
for i in l:
	sh += abs(i - p)
print(sh)


def answer():
	a = input().split()
	a = [int(x) for x in a]
	a.sort()
	return a[2] - a[0]
print(answer())


a = list(map(int, input().split()))
d = s = i = j = k = 0
d = max(a)
max1 = 999999999
for i in range(d):
	for j in range(len(a)):
		if a[j] - i > 0:
			s += a[j] - i
		else:
			s += i - a[j]
	if s <= max1:
		max1 = s
	s = 0
print(max1)


import re
s = input()
ans = s.split()
x1 = int(ans[0])
x2 = int(ans[1])
x3 = int(ans[2])
print(max(abs(x1 - x2), abs(x2 - x3), abs(x3 - x1)))


li = list(map(int, input().split()))
li.sort()
print(li[1] - li[0] + li[2] - li[1])


li = list(map(int, input().split(' ')))
li.sort()
(a, b, c) = li
print(c - a)


li = list(map(int, input().split()))
maxi = max(li)
mini = min(li)
print(maxi - mini)


a = list(map(int, input().split()))
b = sorted(a)
c = abs(b[1] - b[0])
d = abs(b[2] - b[1])
print(c + d)


list1 = [int(x) for x in input().split()]
list1.sort()
n = len(list1)
t = 0
for i in range(n // 2):
	t += list1[n - 1 - i] - list1[i]
print(t)


def min_dist(a):
	return list_of_integers[2] - list_of_integers[0]
a = input().split()
b = map(int, a)
list_of_integers = list(b)
print(min_dist(list_of_integers.sort()))


s = sorted(list(map(int, input().split())))
a = abs(s[1] - s[0])
b = abs(s[1] - s[2])
print(a + b)


a = list(map(int, input().split()))
a = sorted(a)
print(max(a) - min(a))


arr = list(map(int, input().split()))
arr.sort()
b = arr.pop(1)
print(b - arr[0] + arr[-1] - b)


x = list(map(int, input().split()))
x = sorted(x)
print(str(x[1] - x[0] + x[2] - x[1]))


k = input()
x1 = int(k.split(' ')[0])
x2 = int(k.split(' ')[1])
x3 = int(k.split(' ')[2])
a = max(x1, x2)
b = max(a, x3)
aa = min(x1, x2)
bv = min(aa, x3)
n = b - bv
print(n)


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import collections as col
import math, string

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 10 ** 9 + 7

def solve():
	A = getInts()
	A.sort()
	return A[2] - A[0]
print(solve())


import math
b = list(map(int, input().split()))
if b[0] < b[1] and b[0] > b[2] or (b[0] > b[1] and b[0] < b[2]):
	a = b[0]
if b[1] < b[0] and b[1] > b[2] or (b[1] > b[0] and b[1] < b[2]):
	a = b[1]
if b[2] < b[0] and b[2] > b[1] or (b[2] > b[0] and b[2] < b[1]):
	a = b[2]
print(abs(a - b[0]) + abs(a - b[1]) + abs(a - b[2]))


z = [int(x) for x in input().split()]
print(max(z) - min(z))


(A, B, C) = input().split()
(A, B, C) = (int(A), int(B), int(C))
print(max(A, B, C) - min(A, B, C))


from sys import stdin, stdout
(a, b, c) = stdin.readline().split()
(a, b, c) = (int(a), int(b), int(c))
high = max(a, b, c)
low = min(a, b, c)
for i in (a, b, c):
	if i != high and i != low:
		mid = i
dist = 99
for i in range(low + 1, mid + 1):
	temp = abs(low - i) + abs(mid - i) + abs(high - i)
	if temp < dist:
		dist = temp
stdout.write(str(dist))


point = list(map(int, input().split()))
point = sorted(point)
print(point[2] - point[0])


(a, b, c) = list(map(int, input().split()))
min_r = 300
for i in range(1, 101):
	x = abs(a - i) + abs(b - i) + abs(c - i)
	if x < min_r:
		min_r = x
print(min_r)


(x1, x2, x3) = [int(x) for x in input().split(' ')]
dist_lst = [x1, x2, x3]
dist_final = sorted(dist_lst)
print(dist_final[1] - dist_final[0] + (dist_final[2] - dist_final[1]))


mylist = []
(a, b, c) = input().split()
a = int(a)
b = int(b)
c = int(c)
mylist.append(a)
mylist.append(b)
mylist.append(c)
mylist.sort()
subtraction = int(abs(mylist[0] - mylist[1]) + abs(mylist[1] - mylist[2]))
print(subtraction)


friends = list(map(int, input().split()))
distance = 0
if len(friends):
	distance = max(friends) - min(friends)
print('{}'.format(distance))


import math
(x, y, z) = map(int, input().split())
if x > y and x < z or (x > z and x < y):
	mid = x
	dist = abs(x - y) + abs(x - z)
elif z > y and x > z or (x < z and z < y):
	mid = z
	dist = abs(z - y) + abs(x - z)
else:
	mid = y
	dist = abs(x - y) + abs(y - z)
print(dist)


def length():
	leastdistance = 0
	place = sorted(map(int, input().split()))
	for L in range(len(place)):
		leastdistance += int(abs(place[1] - place[L]))
	print(leastdistance)
length()


def main():
	a = list(map(int, input().split()))
	a.sort()
	ans = abs(a[0] - a[1]) + abs(a[1] - a[2])
	print(ans)

def __starting_point():
	main()
__starting_point()


l = [int(i) for i in input().split()]
l.sort()
t = 0
for i in l:
	t += abs(i - l[1])
print(t)


bint = [int(item) for item in input().split()]
print(max(bint) - min(bint))


def solution():
	ab = abs
	best = 100
	x = tuple(map(int, input().split()))
	for y in range(1, max(x) + 1):
		z = ab(x[0] - y) + ab(x[1] - y) + ab(x[2] - y)
		if z < best:
			best = z
	print(best, end='')
solution()


pp = [int(ttt) for ttt in input().split()]
pp.sort()
print(pp[2] - pp[0])


def The_New_Year_Meeting_Friends(x1, x2, x3):
	li = [x1, x2, x3]
	li.sort()
	ans = li[2] - li[1] + (li[1] - li[0])
	print(ans)
(x1, x2, x3) = map(int, input().split())
The_New_Year_Meeting_Friends(x1, x2, x3)


read = lambda : map(int, input().split())
(x1, x2, x3) = sorted(read())
print(abs(x2 - x1) + abs(x3 - x2))


import pdb
(a, b, c) = map(int, input().split())
print(max(a, b, c) - min(a, b, c))


from sys import stdin

def main():
	lista = [int(x) for x in stdin.readline().strip().split()]
	while lista != []:
		(x1, x2, x3) = (lista[0], lista[1], lista[2])
		oper1 = abs(x1 - x2) + abs(x1 - x3)
		oper2 = abs(x2 - x3) + abs(x2 - x1)
		oper3 = abs(x3 - x1) + abs(x3 - x2)
		lista2 = []
		lista2.append(oper1)
		lista2.append(oper2)
		lista2.append(oper3)
		lista2.sort()
		print(lista2[0])
		lista = [int(x) for x in stdin.readline().strip().split()]
main()


(a, b, c) = input().split()
a = int(a)
b = int(b)
c = int(c)
d = []
d.append(a)
d.append(b)
d.append(c)
d.sort()
s = 0
s += d[1] - d[0]
s += d[2] - d[1]
print(s)


a = str(input())
a = a.split()
q = int(a[0])
z = int(a[1])
w = int(a[2])
a = [q, z, w]
print(int(max(a)) - int(min(a)))


houses = [int(a) for a in input().strip().split(' ')]
print(max(houses) - min(houses))


myl = list(map(int, input().split()))
list.sort(myl)
total = 0
for x in range(0, len(myl) - 1):
	total += myl[x + 1] - myl[x]
print(total)


num = input()
list = [int(x) for x in num.split()]
x1 = max(list)
x3 = min(list)
print(x1 - x3)


ar = list(map(int, input().split()))
ar.sort()
print(ar[2] - ar[0])


from sys import stdin

def main():
	a = [int(x) for x in stdin.readline().strip().split()]
	a.sort()
	suma = 0
	for i in range(len(a) - 1):
		suma += a[i + 1] - a[i]
	print(suma)
main()


A = list(map(int, input().split()))
A.sort()
sum = 0
for i in range(len(A) - 1):
	sum += A[i + 1] - A[i]
print(sum)


place = [int(x) for x in input().split()]
dis = max(place) - min(place)
print(int(dis))


(x1, x2, x3) = map(int, input().split())
if x1 == x2 == x3:
	print(0)
elif x2 == x3:
	print(abs(x1 - x2))
elif x1 == x3:
	print(abs(x1 - x2))
elif x1 == x2:
	print(abs(x1 - x3))
else:
	a = b = x1
	for i in [x1, x2, x3]:
		if i > a:
			a = i
		if i < b:
			b = i
	for i in [x1, x2, x3]:
		if i != a and i != b:
			print(abs(x1 - i) + abs(x2 - i) + abs(x3 - i))


def main():
	a = [int(x) for x in input().split()]
	a.sort()
	print(a[1] - a[0] + (a[2] - a[1]))
main()


l = list(map(int, input().strip().split()))
l.sort()
a = l[1]
print(l[2] - l[0])


(x, y, z) = map(int, input().split())
a = max(x, y, z)
b = min(x, y, z)
line = []
for i in range(b, a + 1):
	s = abs(x - i) + abs(y - i) + abs(z - i)
	line.append(s)
print(min(line))


f = list(map(int, input().split()))
f.sort()
print(f[2] - f[0])


inp1 = input()
inp1 = inp1.split()
inp1 = [int(x) for x in inp1]
inp1.sort()
x1 = int(inp1[0])
x2 = int(inp1[1])
x3 = int(inp1[2])
ans = x3 - x2 + (x2 - x1)
print(ans)


(a, b, c) = map(int, input().split())
l = [a, b, c]
l.sort()
l.reverse()
d = l[0] - l[1]
w = l[1] - l[2]
print(d + w)


def main():
	temp_list = input().split(' ')
	main_list = []
	for i in range(3):
		main_list.append(int(temp_list[i]))
	main_list.sort()
	a = main_list[1] - main_list[0]
	b = main_list[2] - main_list[1]
	result = a + b
	print(result)
main()


(n, m, k) = input().split()
(n, m, k) = (int(n), int(m), int(k))
center = n + m + k - (min(m, n, k) + max(m, n, k))
print(abs(n - center) + abs(m - center) + abs(k - center))


(a, b, c) = map(int, input().split())
m = min(a, b, c)
M = max(a, b, c)
print(M - m)


hlist = list(map(int, input().split()))
hlist.sort()
print(hlist[1] - hlist[0] + (hlist[2] - hlist[1]))


b = [int(x) for x in input().split()]
print(max(b) - min(b))


import sys
import os
import math
import operator
mod = 1000000007
Mod = 998244353

def Pow(x, y):
	if y == 0:
		return 1
	p = Pow(x, y // 2) % mod
	p = p * p % mod
	if y % 2 == 0:
		return p
	else:
		return x * p % mod

def modInv(a, m):
	return Pow(a, m - 2)

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
a = [int(x) for x in input().split()]
a.sort()
res = 0
res += a[1] - a[0]
res += a[2] - a[1]
print(res)


(x1, x2, x3) = map(int, input().split())
a = []
a.append(x1)
a.append(x2)
a.append(x3)
a.sort()
x = abs(a[1] - a[0])
y = abs(a[1] - a[2])
s = x + y
print(s)


posns = list(map(int, input().split()))
posns.sort()
print(abs(posns[-1] - posns[0]))


a = input()
b = list(map(int, a.split()))
s = sum(b)
M = 99999999999999
for now in range(min(b), max(b) + 1):
	r = 0
	for each in b:
		r += abs(each - now)
	M = min(r, M)
print(M)


a = list(map(int, input().split()))
p = sorted(a)
print(p[-1] - p[0])


ox = map(int, input().split())
ox = sorted(ox)
d = ox[2] - ox[0]
print(d)


while True:
	try:
		str = input().split(' ')
		x1 = int(str[0])
		x2 = int(str[1])
		x3 = int(str[2])
		max = x1
		min = x1
		if x2 > max:
			max = x2
		if x3 > max:
			max = x3
		if x2 < min:
			min = x2
		if x3 < min:
			min = x3
		print(max - min)
	except:
		break


dis = [int(i) for i in input().split()]
d1 = abs(dis[1] - dis[0])
d2 = abs(dis[2] - dis[1])
d3 = abs(dis[2] - dis[0])
L1 = d1 + d2
L2 = d1 + d3
L1 = min(L1, L2)
L1 = min(L1, d2 + d3)
print(L1)


(s, m, k) = map(int, input().split())
print(max(s, m, k) - min(m, s, k))


(a, b, c) = input().split()
a = int(a)
b = int(b)
c = int(c)
if a < b < c or c < b < a:
	x = c - b
	y = b - a
	x = abs(x)
	y = abs(y)
if b < a < c or c < a < b:
	x = c - a
	y = a - b
	x = abs(x)
	y = abs(y)
if a < c < b or b < c < a:
	x = b - c
	y = c - a
	x = abs(x)
	y = abs(y)
print(x + y)


(a, b, c) = input().split()
a = int(a)
b = int(b)
c = int(c)
m = max(a, b, c)
n = min(a, b, c)
s = a + b + c - m - n
print(s - n + m - s)


def meu_map(lista):
	for i in range(len(lista)):
		lista[i] = int(lista[i])

def bubblesort(lista):
	for j in range(len(lista) - 1):
		for i in range(len(lista) - 1):
			if lista[i] > lista[i + 1]:
				(lista[i], lista[i + 1]) = (lista[i + 1], lista[i])
pontos = input().split()
meu_map(pontos)
bubblesort(pontos)
dist1 = pontos[1] - pontos[0]
dist2 = pontos[2] - pontos[1]
print(dist1 + dist2)


from sys import stdin
_input = stdin.readline
(_int, _min, _max, _abs) = (int, min, max, abs)

def solution():
	arr = [_int(i) for i in _input().split()]
	a = _min(arr)
	b = _max(arr)
	arr.remove(a)
	arr.remove(b)
	c = arr[0]
	print(_abs(a - c) + _abs(b - c))
solution()


h = [int(i) for i in input().split()]
if h[0] > h[1]:
	(h[1], h[0]) = (h[0], h[1])
if h[1] > h[2]:
	(h[1], h[2]) = (h[2], h[1])
if h[0] > h[1]:
	(h[1], h[0]) = (h[0], h[1])
print(abs(h[0] - h[1]) + (h[2] - h[1]))


(a, b, c) = map(int, input().split())
mi = min(a, b, c)
mx = max(a, b, c)
s = 1000
for i in range(mi, mx + 1):
	t = abs(i - a) + abs(i - b) + abs(i - c)
	if t < s:
		s = t
print(s)


s = input().split()
for i in range(3):
	s[i] = int(s[i])
s.sort()
k = int(s[2]) - int(s[0])
print(k)


coords = list(map(int, input().split()))
coords = sorted(coords)
half = coords[1]
res = 0
for i in coords:
	if i == half:
		continue
	else:
		res += abs(half - i)
print(res)


x_nums = list(map(int, input().split()))
x_max = max(x_nums)
x_min = min(x_nums)
dist_min = float('INF')
for i in range(x_min, x_max + 1):
	tmp = 0
	for x in x_nums:
		tmp += abs(i - x)
	dist_min = min(dist_min, tmp)
print(dist_min)


a = list(map(int, input().split()))
b = sorted(a)
dis = b[1] - b[0] + (b[2] - b[1])
print(dis)


(a, b, c) = input().split()
a = int(a)
b = int(b)
c = int(c)
ma = max(a, b)
ma = max(ma, c)
mi = min(a, b)
mi = min(mi, c)
me = a + b + c - (mi + ma)
x = ma - me + (me - mi)
print(x)


xs = list(map(int, input().split(' ')))
print(max(xs) - min(xs))


(first, second, third) = sorted(map(int, input().split()))
print(third - first)


(a, b, c) = map(int, input().split())
ans = a + b + c
for i in range(min(a, b, c), max(a, b, c) + 1):
	ans = min(abs(i - a) + abs(i - b) + abs(i - c), ans)
print(ans)


(a, b, c) = sorted([int(i) for i in input().split()])
print(c - a)


l = list(map(int, input().split()))
l.sort()
(x1, x2, x3) = (l[0], l[1], l[2])
ans = 400
for i in range(x1 + 1, x3):
	sum = abs(x1 - i) + abs(x2 - i) + abs(x3 - i)
	if sum < ans:
		ans = sum
print(ans)


l = list(map(int, input().split()))
l.sort()
print(l[2] - l[0])


(a, b, c) = map(int, input().split())
l = [a, b, c]
l.sort()
n = l[1]
p = abs(n - l[0])
q = abs(l[2] - n)
print(p + q)


lst = input().split()
lst2 = [int(i) for i in lst]
x = max(lst2)
y = min(lst2)
lst2.remove(x)
lst2.remove(y)
z = lst2[0]
print(x - y)


friends = list(map(int, input().split()))
friends1 = sorted(friends)
diff1 = friends1[1] - friends1[0]
diff2 = friends1[2] - friends1[1]
print(diff1 + diff2)


n = list(map(int, input().split()))
n.sort()
s = n[1] - n[0]
w = n[2] - n[1]
print(s + w)


dists = [int(i) for i in input().split()]
dists.sort()
res = dists[1] - dists[0] + dists[2] - dists[1]
print(str(res))


friends = list(map(int, input().split(' ')))
friends.sort()
distance = friends[2] - friends[1] + (friends[1] - friends[0])
print(distance)


mylist = input().split()
for i in range(len(mylist)):
	mylist[i] = int(mylist[i])
mylist = sorted(mylist)
distance = mylist[2] - mylist[1] + (mylist[1] - mylist[0])
print(distance)


(a, b, c) = [int(x) for x in input().split(' ')]
d = [a, b, c]
d.sort()
dist = 0
mindis = d[2] + 1
for i in range(d[0], d[2] + 1):
	dist = abs(i - d[0]) + abs(i - d[1]) + abs(i - d[2])
	if dist < mindis:
		mindis = dist
print(mindis)


arr = sorted(list(map(int, input().split())))
print(max(arr) - arr[1] + (arr[1] - min(arr)))


x = list(map(int, input().split()))
x = sorted(x)
distance = abs(x[0] - x[1]) + abs(x[1] - x[2])
print(distance)


(x1, x2, x3) = map(int, input().split())
diff1 = abs(x1 - x2)
diff2 = abs(x2 - x3)
diff3 = abs(x1 - x3)
print(max(diff1, diff2, diff3))


inp = input().split(' ')
inp = [int(inp[i]) for i in range(3)]
inp.sort()
avg = (inp[0] + inp[2]) / 2
dist = abs(inp[1] - inp[0]) + abs(inp[2] - inp[1])
print(int(dist))


a = input().split(' ')
arr = []
for i in a:
	arr.append(int(i))
arr.sort()
print(arr[2] - arr[0])


def new_year():
	positions = [int(x) for x in input().strip().split(' ')]
	return max(positions) - min(positions)
print(new_year())


(x, y, z) = map(int, input().strip().split())
if x >= y and y >= z or (z >= y and y >= x):
	print(abs(x - y) + abs(y - z))
elif y >= x and x >= z or (z >= x and x >= y):
	print(abs(x - y) + abs(x - z))
elif y >= z and z >= x or (x >= z and z >= y):
	print(abs(z - y) + abs(x - z))


sequence = [int(i) for i in input().split(' ')]
print(max(sequence) - min(sequence))


def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
(a, b, c) = mi()
l = []
l.append(a)
l.append(b)
l.append(c)
l.sort()
ans = l[1] - l[0]
ans += l[2] - l[1]
print(ans)


coordinates_list = list(map(int, input().split()))
coordinates_list.sort()
print(coordinates_list[2] - coordinates_list[0])


x = [int(x) for x in input().split()]
minimal = min(x)
maximal = max(x)
for elem in x:
	if elem != maximal and elem != minimal:
		punkt = elem
abstand = 0
for elem in x:
	abstand += abs(elem - punkt)
print(abstand)


friends = list(map(int, input().split()))
maximum = 0
minimum = 101
for i in range(3):
	if friends[i] > maximum:
		maximum = friends[i]
	if friends[i] < minimum:
		minimum = friends[i]
print(maximum - minimum)


(var1, var2, var3) = map(int, input().split())
tim = sorted([var1, var2, var3])
fOne = int(tim[0])
fTwo = int(tim[1])
fThree = int(tim[2])
totald = fThree - fTwo + (fTwo - fOne)
print(int(totald))


listVar = input().split()
listVar = [int(i) for i in listVar]
for i in range(0, 3):
	for j in range(i + 1, 3):
		if listVar[i] > listVar[j]:
			(listVar[i], listVar[j]) = (listVar[j], listVar[i])
print(listVar[2] - listVar[0])


d = []
anz = 0
(a, b, c) = [int(x) for x in input().split()]
d.append(a)
d.append(b)
d.append(c)
d.sort()
anz = d[2] - d[0]
print(anz, end='\n')


m = [*map(int, input().split())]
m.sort()
print(m[2] - m[0])


import sys
a = []
for line in sys.stdin:
	line = line.strip()
	temp = line.split(' ')
	for x in temp:
		a.append(int(x))
a_min = min(a)
a_max = max(a)
pri = (a_min + a_max) / 2
best = 1000000
for i in range(a_min, a_max):
	sum = 0
	for x in a:
		sum += abs(x - i)
	best = min(sum, best)
print(best)


arr = [int(x) for x in input().split()]
arr.sort()
diff1 = arr[1] - arr[0]
diff2 = arr[2] - arr[1]
print(diff1 + diff2)


def function(x1, x2, x3):
	max = x1
	min = x1
	if x2 > max:
		max = x2
	if x3 > max:
		max = x3
	if x2 <= min:
		min = x2
	if x3 <= min:
		min = x3
	return max - min
x = input('')
x = x.split(' ')
x1 = int(x[0])
x2 = int(x[1])
x3 = int(x[2])
print(function(x1, x2, x3))


[a, b, c] = [int(x) for x in input().split()]
mi = min(a, b, c)
ma = max(a, b, c)
av = (ma + mi) // 2
dx = abs(av - a) + abs(av - b) + abs(av - c)
print(f'{ma - mi}')


from sys import stdin, stdout, argv
from collections import defaultdict, Counter
printer = print

def input():
	return stdin.readline().rstrip()

def print(string):
	printer(string, file=stdout)
(a, b, c) = (int(s) for s in input().split())
m = min(a, b, c)
a -= m
b -= m
c -= m
print(max(a, b, c))


num = str(input(''))
n = num.split(' ')
x = int(n[0])
y = int(n[1])
z = int(n[2])
dis = abs(x - y) + abs(x - z)
if abs(x - y) + abs(y - z) < dis:
	dis = abs(x - y) + abs(y - z)
if abs(x - z) + abs(y - z) < dis:
	dis = abs(x - z) + abs(y - z)
print(dis)


x = sorted([int(x) for x in input().split()])
print(x[1] - x[0] + x[2] - x[1])


(a, b, c) = map(int, input().split())
co = list((a, b, c))
co.sort()
ans = co[1] - co[0] + (co[2] - co[1])
print(ans)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
sys.setrecursionlimit(100000000)
ii = lambda : int(input())
si = lambda : input()
jn = lambda x, l: x.join(map(str, l))
sl = lambda : list(map(str, input().strip()))
mi = lambda : map(int, input().split())
mif = lambda : map(float, input().split())
lii = lambda : list(map(int, input().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
mod = 1000000007
(a, b, c) = mi()
a1 = abs(a - b) + abs(a - c)
b1 = abs(b - a) + abs(b - c)
c1 = abs(a - c) + abs(b - c)
print(min(a1, b1, c1))


arr = list(map(int, input().split()))
arr.sort()
x = arr[1]
y = abs(x - arr[0]) + abs(x - arr[-1])
print(y)


n = []
n = [int(i) for i in input().split()]
n = sorted(n)
print(n[2] - n[1] + n[1] - n[0])


l = list((int(x) for x in input().split()))
min = min(l)
max = max(l)
l.pop(l.index(min))
l.pop(l.index(max))
print(abs(l[0] - max) + l[0] - min)


c = 0
q = []
l = list(map(int, input().split()))
for i in l:
	q.append(i)
q.remove(max(q))
x = max(q)
for j in l:
	c = c + abs(x - j)
print(c)


x = [int(y) for y in input().split()]
print(max(x) - min(x))


t = list(map(int, input().split()))
print(max(t) - min(t))


h = list(map(int, input().split()))
h.sort()
print(h[1] - h[0] + (h[2] - h[1]))


l = list(map(int, input().split()))
l.sort()
res = l[1] - l[0] + (l[2] - l[1])
print(res)


l = list(map(int, input().split(' ')))

def mayor(a, b):
	if a > b:
		return (a, b)
	else:
		return (b, a)

def menor(a, b):
	if a > b:
		return (b, a)
	else:
		return (a, b)
l = sorted(l)
(a, b) = mayor(l[0], l[1])
(e, c) = menor(a, l[2])
print(abs(e - b) + abs(e - c))


s = input().split(' ')
mn = 100
mx = 1
pos = [0] * 3
for i in range(3):
	pos[i] = int(s[i])
	mx = max(mx, pos[i])
	mn = min(mn, pos[i])
dis = 3 * mx
for i in range(mn, mx + 1):
	dis = min(dis, abs(pos[1] - i) + abs(pos[0] - i) + abs(pos[2] - i))
print(dis)


(a, b, c) = sorted(map(int, input().split()))
m = max(0, b - a) + max(0, c - b)
print(m)


def A():
	num = [int(x) for x in input().split()]
	dist = 999
	for i in range(1, 101):
		dist = min(abs(num[0] - i) + abs(num[1] - i) + abs(num[2] - i), dist)
	print(dist)
A()


(a, b, c) = map(int, input().split())
p = max(a, b, c)
t = min(a, b, c)
s = a + b + c - p - t
print(p - t)


l = [int(n) for n in input().split()]
res = []
res.append(abs(l[0] - l[1]) + abs(l[0] - l[2]))
res.append(abs(l[0] - l[1]) + abs(l[1] - l[2]))
res.append(abs(l[0] - l[2]) + abs(l[1] - l[2]))
print(min(res))


l = list(map(int, input().split()))
mn = min(l)
mx = max(l)
print(mx - mn)


a = sorted([int(i) for i in input().split()])
print(a[2] - a[0])


(a, b, c) = map(int, input().split())
mx = max(a, b, c)
mi = min(a, b, c)
print(mx - mi)


(x, y, z) = map(int, input().split())
a = max(x, max(y, z))
b = min(x, min(y, z))
c = x + y + z - a - b
mina = 1000000
for i in range(b, a + 1):
	tmp = abs(a - i) + abs(b - i) + abs(c - i)
	if tmp < mina:
		mina = tmp
print(mina)


import math
x = input().split()
x = [int(i) for i in x]
ma = 10000000
m = []
m.append(math.fabs(x[0] - x[1]) + math.fabs(x[0] - x[2]))
m.append(math.fabs(x[1] - x[0]) + math.fabs(x[1] - x[2]))
m.append(math.fabs(x[2] - x[1]) + math.fabs(x[2] - x[0]))
for i in range(3):
	if m[i] < ma:
		ma = m[i]
print(int(ma))


import sys
l = list(map(int, input().split()))
l.sort()
print(l[2] - l[0])


coord = sorted(map(int, input().split()))
print(coord[2] - coord[0])


(a, b, c) = map(int, input().split())
ans = max(a, b, c) - min(a, b, c)
print(ans)


(a, b, c) = list(map(int, input().split()))
mi = min(a, b, c)
ma = max(a, b, c)
sr = a + b + c - mi - ma
print(ma - sr + (sr - mi))


(a, b, c) = input().split(' ')
pt1 = int(a)
pt2 = int(b)
pt3 = int(c)
lineWorld = [pt1, pt2, pt3]
lineWorld.sort()
total = lineWorld[2] - lineWorld[0]
print(total)


li = [int(num) for num in input().split()]
li.sort()
x = li[1] - li[0]
y = li[2] - li[1]
s = x + y
print(s)


import sys
it = iter(sys.stdin.read().splitlines())
numbers = [int(x) for x in next(it).split()]
numbers.sort()
(a, b, c) = (numbers[0], numbers[1], numbers[2])
distance = c - b + b - a
print(int(distance))


x = list(map(int, input().split()))
a = min(x)
b = max(x)
rust = b - a
print(rust)


s = input()
coordinates = [int(k) for k in s.split(' ')]
coordinates.sort()
print(coordinates[-1] - coordinates[0])


y = input()
x = y.split()
u = 0
t = 0
w = 0
for i in range(len(x)):
	r = int(x[i])
	if r >= u:
		w = t
		t = u
		u = r
	elif r <= u and r >= t:
		w = t
		t = r
	if r < t:
		w = r
s = u - t + (u - w)
n = u - t + (t - w)
a = u - w + (t - w)
p = 0
if s <= n <= a:
	print(s)
elif s <= a <= n:
	print(s)
if a <= s <= n:
	print(a)
elif a <= n <= s:
	print(a)
if n <= s <= a:
	print(n)
elif n <= a <= s:
	print(n)


(a, b, c) = input().split()
a = int(a)
b = int(b)
c = int(c)
if a >= b and b >= c:
	print(a - c)
elif a >= c and c >= b:
	print(a - b)
elif b >= c and c >= a:
	print(b - a)
elif b >= a and a >= c:
	print(b - c)
elif c >= a and a >= b:
	print(c - b)
elif c >= b and b >= a:
	print(c - a)


d = list(map(int, input().split()))
d.sort()
dist = d[2] - d[0]
print(dist)


a = [int(i) for i in input().split()]
b = sorted(a)
print(b[1] - b[0] + (b[2] - b[1]))


pts = [int(x) for x in input().split()]
pts.sort()
d = pts[2] - pts[0]
print(d)


try:
	l = list(map(int, input().split()))
	l.sort()
	a = abs(l[1] - l[0])
	b = abs(l[2] - l[1])
	print(a + b)
except:
	pass


import sys
import bisect
input = sys.stdin.readline

def takeSecond(elem):
	return elem[1]

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
t = 1
for _ in range(t):
	l = list(map(int, input().split()))
	l.sort()
	print(l[1] - l[0] + l[2] - l[1])


import math
x = [int(n) for n in input().split(' ')]
x = sorted(x)
D = x[1] - x[0]
T = x[2] - x[1]
C = D + T
print(C)


a = sorted(list(map(int, input().split())))
ans = 1000
for k in range(a[0], a[2]):
	ans = min(ans, abs(k - a[0]) + abs(k - a[1]) + abs(k - a[2]))
print(ans)


a = input()
a = tuple(map(int, a.split(' ')))
print(max(a) - min(a))


import math
n = input().split()
for i in range(3):
	n[i] = int(n[i])
a = n[0]
b = n[1]
c = n[2]
if a < b and a > c or (a < c and a > b):
	print(abs(c - a) + abs(b - a))
elif c < b and c > a or (c < a and c > b):
	print(abs(c - a) + abs(b - c))
elif b < a and b > c or (c > b and a < b):
	print(abs(c - b) + abs(b - a))


a = list(map(int, input().strip().split()))[:3]
for i in range(3):
	for j in range(2 - i):
		if a[j] > a[j + 1]:
			temp = a[j]
			a[j] = a[j + 1]
			a[j + 1] = temp
print(abs(a[0] - a[2]))


x = [int(i) for i in input().split()]
x = sorted(x)
print(x[2] - x[0])


daude = input()
daude = [int(i) for i in daude.split()]
print(max(daude) - min(daude))


a = list()
a = a + [int(a) for a in input().split()]
w = sum(a) - max(a) - min(a)
print(abs(max(a) - w) + abs(min(a) - w))


n = list(map(int, input().split()))
max1 = max(n)
n.remove(max1)
max2 = max(n)
n.remove(max2)
a = abs(max1 - max2) + abs(max2 - n[0])
print(a)


l = list(map(int, input().split()))
l.sort()
s = l[1] - l[0] + (l[2] - l[1])
print(s)


(a, b, c) = map(int, input().split())
d = a
ct1 = 0
ct2 = 0
ct3 = 0
li = [a, b, c]
for i in range(3):
	ct1 += abs(d - li[i])
d = b
for i in range(3):
	ct2 += abs(d - li[i])
d = c
for i in range(3):
	ct3 += abs(d - li[i])
x = [ct1, ct2, ct3]
print(min(x))


arr = list(map(int, input().split()))
arr.sort()
print(abs(arr[1] - arr[0]) + abs(arr[1] - arr[2]))


houses = sorted(list(map(int, input().split())))
print(houses[1] - houses[0] + houses[2] - houses[1])


b = sorted((int(i) for i in input().split()))
print(max(b) - min(b))


n = input().split(' ')
n.sort()
distanciaMin = 0
a = int(n.pop())
b = int(n.pop())
c = int(n.pop())
lista = [a, b, c]
lista.sort()
valorMedio = lista[1]
for i in range(len(lista)):
	valor = lista[i]
	distanciaMin += abs(valorMedio - valor)
print(distanciaMin)


n = list(map(int, input().split()))
n.sort()
a = (n[0] + n[-1]) // 2
print(n[-1] - n[0])


(x1, x2, x3) = [int(x) for x in input().split()]
Sum = x1 + x2 + x3
print(max(x1, x2, x3) - (Sum - max(x1, x2, x3) - min(x1, x2, x3)) + (Sum - max(x1, x2, x3) - min(x1, x2, x3) - min(x1, x2, x3)))


l = [int(i) for i in input().split()]
print(max(l) - min(l))


a = list(map(int, input().split()))
a.sort()
res = a[2] - a[1] + (a[1] - a[0])
print(res)


t = [int(x) for x in input().split()]
t.sort()
k = abs(t[1] - t[2]) + t[1] - t[0]
print(k)


(a, b, c) = map(int, input().split())
maxi = max(a, max(b, c))
mini = min(a, min(b, c))
if a == maxi or a == mini:
	pass
else:
	k = a
if b == maxi or b == mini:
	pass
else:
	k = b
if c == maxi or c == mini:
	pass
else:
	k = c
print(abs(k - a) + abs(k - b) + abs(k - c))


(n, m, a) = sorted(map(int, input().split()))
t = (n, m, a)
print(t[-1] - t[0])


(a, b, c) = map(int, input().split())
if b == min(a, b, c):
	if a == min(a, c):
		(a, b) = (b, a)
	else:
		(c, b) = (b, c)
if b == max(a, b, c):
	if a == max(a, c):
		(b, a) = (a, b)
	else:
		(c, b) = (b, c)
print(abs(a - b) + abs(c - b))


def _723A(distances):
	distances = sorted(distances)
	return distances[2] - distances[0]
distances = list(map(lambda x: int(x), input().split()))
print(_723A(distances))


def distance(l1):
	x = l1[1] - l1[0]
	y = l1[2] - l1[1]
	return x + y
l1 = list(map(int, input().split()))
l1.sort()
res = distance(l1)
print(res)


(x1, x2, x3) = map(int, input().split())
a = abs(x1 - x2)
b = abs(x1 - x3)
s = a + b
min = s
if abs(x1 - x2) + abs(x2 - x3) < min:
	min = abs(x1 - x2) + abs(x2 - x3)
if abs(x1 - x3) + abs(x2 - x3) < min:
	min = abs(x1 - x3) + abs(x2 - x3)
print(min)


c = list(map(int, input().split()))
k = c.pop(c.index(min(c)))
m = c.pop(c.index(max(c)))
print(abs(c[0] - k) + abs(c[0] - m))


X = list(map(int, input().split()))
X.sort()
print(X[2] - X[0])


m = list(map(int, input().split()))
print(max(m) - min(m))


(n, m, k1) = map(int, input().split())
print(max(n, m, k1) - min(m, n, k1))


xi = [int(x) for x in input().split()]
i = min(xi)
distance = 300
while i <= max(xi):
	distance = min(distance, abs(xi[0] - i) + abs(xi[1] - i) + abs(xi[2] - i))
	i += 1
print(distance)


X = list(map(int, input().split()))
ans = 1 << 40
for x in range(len(X)):
	res = 0
	for y in range(len(X)):
		res += abs(X[x] - X[y])
	ans = min(ans, res)
print(ans)


(x, y, z) = map(int, input().split())
a = [x, y, z]
print(max(a) - min(a))


def main():
	(x1, x2, x3) = map(int, input().split())
	ans = float('infinity')
	for i in range(1, 101):
		ans = min(ans, abs(x1 - i) + abs(x2 - i) + abs(x3 - i))
	print(ans)
main()


inp = sorted([int(x) for x in input().split()])
avg = inp[1]
ret = 0
for i in inp:
	ret += abs(i - avg)
print(ret)


x = list(map(int, input().split()))
min = x[0]
max = x[0]
for i in range(len(x)):
	if min < x[i]:
		min = x[i]
	else:
		min = min
	if max > x[i]:
		max = x[i]
	else:
		max = max
print(min - max)


lst = list(map(int, input().split()))
mx = max(lst)
mn = min(lst)
print(mx - mn)


num = [int(x) for x in input().split()]
list.sort(num)
print(num[2] - num[0])


z = input()
z = [int(i) for i in z.split(' ')]
liste = z
mini = min(liste)
maxi = max(liste)
total = []
for i in range(mini, maxi + 1):
	dist = 0
	for j in liste:
		dist += abs(j - i)
	total.append(dist)
print(min(total))


a = [int(x) for x in input().split()]
if a[0] > a[1]:
	(a[0], a[1]) = (a[1], a[0])
if a[1] > a[2]:
	(a[1], a[2]) = (a[2], a[1])
if a[0] > a[1]:
	(a[0], a[1]) = (a[1], a[0])
print(a[2] - a[0])


numeros = input().split()
maximo = 0
minimo = 10000000000000000000000000000000000000000000000000
for i in range(3):
	if int(numeros[i]) > maximo:
		maximo = int(numeros[i])
	if int(numeros[i]) < minimo:
		minimo = int(numeros[i])
print(maximo - minimo)


inp = list(map(int, input().strip().split()))
min_dist = None
for avg in range(1, 101):
	dist = 0
	for i in inp:
		dist += abs(i - avg)
	if min_dist is None or dist < min_dist:
		min_dist = dist
print(int(min_dist))


a = input().split()
a[0] = int(a[0])
a[1] = int(a[1])
a[2] = int(a[2])
print(max(a) - min(a))


data = input()
splittedInput = data.split(' ')
for i in range(len(splittedInput)):
	splittedInput[i] = int(splittedInput[i])
print(max(splittedInput) - min(splittedInput))


a = [int(x) for x in input().split()]
a.sort()
x1 = a[0]
x2 = a[1]
x3 = a[2]
y = abs(x1 - x2) + abs(x3 - x2)
print(y)


(x1, x2, x3) = map(int, input().split())
d1 = abs(x1 - x2)
d2 = abs(x2 - x3)
d3 = abs(x3 - x1)
print(min(d1 + d3, d2 + d1, d2 + d3))


(a, b, c) = map(int, input().split())
d = []
d.append(a)
d.append(b)
d.append(c)
d.sort()
print(d[2] - d[0])


l = list(map(int, input().split()))
k = sorted(l)
x = k[2]
print(x - k[0] + k[2] - x)


n = input().split()
r = 0
for i in range(3):
	n[i] = int(n[i])
n.sort()
r = abs(n[1] - n[0]) + abs(n[1] - n[2])
print(r)


l = [int(a) for a in input().split(' ')]
length = len(l)
while length > 0:
	count = 0
	while count < len(l) - 1:
		i = l[count]
		if i > l[count + 1]:
			first = l[count]
			second = l[count + 1]
			l[count] = second
			l[count + 1] = first
		count += 1
	length -= 1
ans = l[2] - l[1] + (l[1] - l[0])
print(ans)


a = list(input().split())
b = [0] * 3
k = 0
for i in a:
	b[k] = int(i)
	k = k + 1
lb = sorted(b)
print(int(lb[1]) - int(lb[0]) + (int(lb[2]) - int(lb[1])))


(a, b, c) = input().split(' ')
a = int(a)
b = int(b)
c = int(c)
lis = [a, b, c]
len_lis = []
for i in range(max(lis)):
	da = abs(a - (i + 1))
	db = abs(b - (i + 1))
	dc = abs(c - (i + 1))
	len_lis.append(int(da + db + dc))
print(min(len_lis))


string = input()
l1 = string.split(' ')
l1 = list(map(int, l1))
l1.sort()
x1 = int(l1[0])
x2 = int(l1[1])
x3 = int(l1[2])
d = x3 - x2
d += x2 - x1
print(d)


a = [int(z) for z in input().split()]
print(max(a) - min(a))


a = list(map(int, input().split()))
a1 = min(a)
a2 = max(a)
print(a2 - a1)


(a, b, c) = map(int, input().split())
i = 0
if a > b:
	i = a
	a = b
	b = i
if b > c:
	i = b
	b = c
	c = i
if a > b:
	i = a
	a = b
	b = i
print(c - a)


arr = list(map(int, input().split()))
arr.sort()
b = arr[1] - arr[0] + (arr[2] - arr[1])
print(b)


nums = sorted(list(map(int, input(' ').split())))
print(nums[-1] - nums[-2] + (nums[-2] - nums[-3]))


x = list(map(int, input().split()))
mx = max(x)
mn = min(x)
print(mx - mn)


a = list(map(int, input().split()))
a = sorted(a)
mini = 10000000
for i in range(102):
	if abs(a[0] - i) + abs(a[1] - i) + abs(a[2] - i) < mini:
		mini = abs(a[0] - i) + abs(a[1] - i) + abs(a[2] - i)
print(mini)


(x, y, z) = map(int, input().split())
lst = [x, y, z]
lst.sort()
print(lst[2] - lst[0])


(a, b, c) = input().split()
(a, b, c) = (eval(a), eval(b), eval(c))
if c > a > b or b > a > c:
	if b > c:
		d = a - c + (b - a)
	else:
		d = c - a + (a - b)
elif a > c > b or b > c > a:
	if a > b:
		d = c - b + (a - c)
	else:
		d = b - c + (c - a)
elif a > c:
	d = a - b + (b - c)
else:
	d = b - a + (c - b)
print(d)


import math
(a, b, c) = map(int, input().split(' '))
print(max(a, b, c) - min(a, b, c))


(x, y, z) = map(int, input().split())
a = abs(x - y) + abs(x - z)
b = abs(y - x) + abs(y - z)
c = abs(z - x) + abs(z - y)
if a < b and a < c:
	print(a)
elif c < b and c < a:
	print(c)
else:
	print(b)


(a, b) = sorted(map(int, input().split()))[0:3:2]
print(b - a)


(a, b, c) = map(int, input().split())
s = max(a, b, c) - min(a, b, c)
print(s)


(a, b, c) = map(int, input().split())
d = min(a, b, c)
e = max(a, b, c)
x = d
f = []
while x <= e:
	g = abs(x - a) + abs(x - b) + abs(x - c)
	f.append(g)
	x = x + 1
f = sorted(f)
print(f[0])


n = input()
lst = n.split()
lst = [int(i) for i in lst]
lst.sort()
print(lst[1] - lst[0] + (lst[2] - lst[1]))


l = [int(x) for x in input().split()]
minn = min(l)
maxn = max(l)
print(maxn - minn)


straight = list(map(int, input().split()))
min_straight = min(straight)
max_straight = max(straight)
list1 = []
for j in straight:
	list1.append(abs(j - straight[0]))
	min_distance = sum(list1)
list1 = []
for i in range(min_straight, max_straight + 1):
	for j in straight:
		list1.append(abs(j - i))
	if sum(list1) < min_distance:
		min_distance = sum(list1)
	list1 = []
print(min_distance)


(a, b, c) = list(map(int, input().split()))
ans = 305
for i in range(1, 101):
	ans = min(ans, abs(i - a) + abs(i - b) + abs(i - c))
print(ans)


def main():
	A = tuple(map(int, input().rstrip().split()))
	ans = float('inf')
	for x in range(min(A), max(A) + 1):
		ans = min(ans, sum((abs(x - i) for i in A)))
	print(ans)
main()


(x1, x2, x3) = map(int, input().split())
l = [x1, x2, x3]
s = sorted(l)
X = abs(s[1] - s[0])
Y = abs(s[1] - s[2])
print(X + Y)


locations = [int(x) for x in input().split()]
max_loc = min_loc = locations[0]
for i in locations:
	if i > max_loc:
		max_loc = i
	elif i < min_loc:
		min_loc = i
print(max_loc - min_loc)


import sys
x = sorted(list(map(int, sys.stdin.readline().split(' '))))
print(x[1] - x[0] + x[2] - x[1])


l = list(map(int, input().rstrip().split()))
l.sort()
print(l[1] - l[0] + (l[2] - l[1]))


from sys import setrecursionlimit, exit
from math import ceil, floor, acos, pi
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from functools import reduce
from collections import Counter
import itertools
import queue
setrecursionlimit(10 ** 7)
RI = lambda x=' ': list(map(int, input().split(x)))
RS = lambda x=' ': input().rstrip().split(x)
dX = [-1, 1, 0, 0, -1, 1, -1, 1]
dY = [0, 0, -1, 1, 1, -1, -1, 1]
mod = int(1000000000.0 + 7)
eps = 1e-06
MAX = 2 ** 32 - 1
x = RI()
print(max(x) - min(x))


k = input().split()
a = int(k[0])
b = int(k[1])
c = int(k[2])
print(max(a, b, c) - min(a, b, c))


j = input().split()
l = len(j)
i = 0
while i < l:
	j[i] = int(j[i])
	i = i + 1
k = max(j)
l = min(j)
ans = k - l
print(ans)


l = list(map(int, input().split()))
(a, b, c) = (0, 0, 0)
a = abs(l[0] - l[1]) + abs(l[0] - l[2])
b = abs(l[0] - l[1]) + abs(l[1] - l[2])
c = abs(l[2] - l[1]) + abs(l[0] - l[2])
print(min(a, b, c))


(x, y, z) = map(int, input().split())
p = min(x, y, z)
q = max(x, y, z)
d = q - p
print(d)


p = list(map(int, input().split()))
p.sort()
print(abs(p[1] - p[0]) + abs(p[1] - p[2]))


n = list(map(int, input().split()))
n.sort()
print(abs(n[1] - n[0]) + abs(n[1] - n[2]))


(a, b, c) = map(int, input().split())
l = [abs(a - b), abs(b - c), abs(c - a)]
l.sort()
print(sum(l[:2]))


def main():
	vals = [int(v) for v in input().split()]
	vals.sort()
	print(vals[2] - vals[1] + (vals[1] - vals[0]))
main()


import sys, math, string
input = sys.stdin.readline
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split().strip())
M = lambda : map(int, input().split())
l = L()
l.sort()
print(l[2] - l[0])


(a, b, c) = map(int, input().split())
ans = 10 ** 9
for i in range(1, 100 + 1):
	s = abs(a - i) + abs(b - i) + abs(c - i)
	ans = min(ans, s)
print(ans)


a = input()
a = a.split()
a[0] = int(a[0])
a[1] = int(a[1])
a[2] = int(a[2])
a.sort()
print(a[2] - a[1] + (a[1] - a[0]))


a = [int(x) for x in input().split()]
aa = sum(a)
x1 = max(a)
x2 = min(a)
x3 = aa - x1 - x2
print(abs(x3 - x1) + abs(x3 - x2))


x = list(map(int, input().split()))
med = x[3 - x.index(min(x)) - x.index(max(x))]
ans = 0
ans += max(x) - med
ans += med - min(x)
print(ans)


Path = list(map(int, input().split()))
Path.sort()
A = abs(Path[0] - Path[1])
B = abs(Path[1] - Path[2])
Distance = A + B
print(Distance)


(x, y, z) = map(int, input().split())
dist = []
dist.append(abs(x - y) + abs(x - z))
dist.append(abs(y - x) + abs(y - z))
dist.append(abs(z - x) + abs(z - y))
print(min(dist))


points = list(map(int, input().split()))
points.sort()
res = abs(points[1] - points[0]) + abs(points[2] - points[1])
print(res)


arr = input().split()
for i in range(3):
	arr[i] = int(arr[i])
arr.sort()
print(arr[2] - arr[1] + (arr[1] - arr[0]))


li = [int(x) for x in input().split()]
print(max(li) - min(li))


x = list(map(int, input().split()))
x.sort()
a = x[0]
b = x[1]
c = x[2]
y = int(b - a + (c - b))
print(y)


L = list(map(int, input().split()))
L.sort()
print(abs(L[0] - L[1]) + abs(L[2] - L[1]))


x = list(map(int, input().split()))
x.sort()
ans = x[1] - x[0] + (x[2] - x[1])
print(ans)


arr = [int(x) for x in input().split(' ')]
print(max(arr) - min(arr))


x = list(map(int, input().split()))
x1 = max(x)
x2 = min(x)
print(x1 - x2)


numList = [int(x) for x in input().split()]
listMax = 0
listMin = 101
for num in numList:
	if num > listMax:
		listMax = num
	if num < listMin:
		listMin = num
numList.remove(listMax)
numList.remove(listMin)
minDistance = 300
for num in range(listMin, listMax):
	distance = abs(listMax - num) + abs(numList[0] - num) + abs(listMin - num)
	if distance < minDistance:
		minDistance = distance
print(minDistance)


k = input()
q = list(map(int, k.split(' ')))
l = sorted(q)
print(l[2] - l[0])


arr = list(map(int, input().split()))
a = arr[0]
b = arr[1]
c = arr[2]
d = 4999
for m in range(1, 101):
	d = min(d, abs(a - m) + abs(b - m) + abs(c - m))
print(d)


b = list((int(x) for x in input().split()))
x1 = b[0]
x2 = b[1]
x3 = b[2]
l = []
for i in range(min(b), max(b) + 1):
	l.append(abs(x1 - i) + abs(x2 - i) + abs(x3 - i))
print(min(l))


positions = sorted([int(x) for x in input().split()])
print(positions[2] - positions[0])


z = list(map(int, input().split()))
z.sort()
print(z[1] - z[0] + (z[2] - z[1]))


l = input().split()
for i in range(0, len(l)):
	l[i] = int(l[i])
q = l.copy()
q.remove(max(l))
q.remove(min(l))
x = q[0]
print(abs(min(l) - x) + abs(max(l) - x))


import logging
import copy
import sys
import math
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)

def solve(firstLine):
	firstLine.sort()
	return firstLine[1] - firstLine[0] + firstLine[2] - firstLine[1]

def main():
	firstLine = input().split()
	firstLine = list(map(int, firstLine))
	print(solve(firstLine))

def log(*message):
	logging.debug(message)
main()


(x1, x2, x3) = list(map(int, input().split()))
maximum = max(x1, x2)
maximum = max(maximum, x3)
minimum = x1 + x2 + x3
for i in range(maximum):
	m1 = abs(x1 - i)
	m2 = abs(x2 - i)
	m3 = abs(x3 - i)
	if minimum > m1 + m2 + m3:
		minimum = m1 + m2 + m3
print(minimum)


l = [int(x) for x in input().split()]
print(max(l) - min(l))


x = input()
x = x.split()
for i in range(3):
	x[i] = int(x[i])
min = x[0]
max = x[0]
for i in range(3):
	if min > x[i]:
		min = x[i]
	if max < x[i]:
		max = x[i]
print(max - min)


(a, b, c) = [int(x) for x in input().split()]
print(max(a, b, c) - min(a, b, c))


n = list(map(int, input().split()))
n.sort()
print(n[-1] - n[0])


a = sorted(map(int, input().split()))
print(a[2] - a[0])


f = input().split()
a = []
for i in range(3):
	a.append(int(f[i]))
a.sort()
print(a[2] - a[1] + a[1] - a[0])


x = [int(i) for i in input().split()]
print(max(x) - min(x))


n = sorted(list(map(int, input().split())))
num1 = len(n) - 1
m = True
while m == True:
	list_num1 = n[:num1]
	list_num2 = n[num1:]
	sum_1 = sum(list_num1)
	sum_2 = sum(list_num2)
	if sum_1 > sum_2:
		if list_num1[-1] - list_num1[-2] < list_num2[0] - list_num1[-1]:
			num1 -= 1
		else:
			m = False
			index_center = num1 - 1
			meridian = n[index_center]
	else:
		index_center = num1 - 1
		meridian = n[index_center]
		m = False
m = False
count1 = 0
count2 = 0
for i1 in list_num1:
	num2 = meridian - i1
	count1 += num2
for i2 in list_num2:
	num2 = i2 - meridian
	count2 += num2
result = count1 + count2
print(result)


ar = sorted(map(int, input().split()))
print(max(ar) - min(ar))


(n, m, l) = map(int, input().split(' '))
resultado = 0
if n > m and n > l:
	if m < l:
		resultado = n - l + (l - m)
	else:
		resultado = n - m + (m - l)
elif m > n and m > l:
	if n < l:
		resultado = m - l + (l - n)
	else:
		resultado = m - n + (n - l)
elif l > m and l > n:
	if m < n:
		resultado = l - n + (n - m)
	else:
		resultado = l - m + (m - n)
print(resultado)


n = input().split()
my_list = []
for i in n:
	my_list.append(int(i))
my_min = min(my_list)
my_max = max(my_list)
mid = my_list
mid.remove(min(mid))
mid.remove(max(mid))
my_mid = int(' '.join((str(x) for x in mid)))
print(my_mid - my_min + (my_max - my_mid))


l = list(map(int, input().strip().split()))
a = max(l)
b = min(l)
for i in l:
	if i != a and i != b:
		c = i
		print(a - c + c - b)


a = list(map(int, input().split()))
a.sort()
ans = a[1] - a[0] + (a[2] - a[1])
print(ans)


s = list(map(int, input().split()))
k = len(s) - 1
for i in range(len(s) - 1):
	b = 0
	for j in range(k + 1):
		if s[j] > s[b]:
			b = j
	(s[b], s[k]) = (s[k], s[b])
	k = k - 1
v = s[1]
x1 = v - s[0]
x2 = s[2] - v
x3 = x2 + x1
print(x3)


friends = [int(i) for i in input().split()]
friends_sorted = sorted(friends)
min_distance = 1000000

def cal_distance(friends_list, i):
	sum_ = 0
	for f in friends_list:
		sum_ += abs(f - i)
	return sum_
for i in range(friends_sorted[0], friends_sorted[-1] + 1):
	distance = cal_distance(friends_sorted, i)
	if distance < min_distance:
		min_distance = distance
print(min_distance)


res = 0
a = [int(i) for i in input().split()]
a.sort()
m = a[-2]
for i in range(len(a)):
	res += abs(a[i] - m)
print(res)


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [Scanner.string() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [Scanner.int() for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def solve():
	X = Scanner.map_int()
	ans = INF
	for i in range(1, 101):
		ans = min(ans, sum([abs(x - i) for x in X]))
	print(ans)

def main():
	solve()
main()


(x1, x2, x3) = map(int, input().split())
a1 = [x1, x2, x3]
a = [x1, x2, x3]
max1 = max(a)
min1 = min(a)
a.remove(max1)
a.remove(min1)
for i in range(len(a)):
	middle = a[i]
for i in range(len(a1)):
	a1[i] = abs(a1[i] - middle)
print(sum(a1))


n = [int(i) for i in input().split()]
n.sort()
print(n[2] - n[0])


line = input().split()
a = int(line[0])
b = int(line[1])
c = int(line[2])
first = abs(b - a) + abs(c - a)
second = abs(a - b) + abs(c - b)
third = abs(a - c) + abs(b - c)
dis = min(first, second, third)
print(dis)


l1 = [int(i) for i in input().split(' ')]
l1 = sorted(l1)
s1 = l1[1] - l1[0]
l = l1[2] - l1[1]
print(s1 + l)


def main():
	from sys import stdin, stdout
	(x, y, z) = map(int, stdin.readline().split())
	minim = min(x, y, z)
	maxim = max(x, y, z)
	minimum = -1
	for i in range(minim, maxim + 1):
		if minimum < 0:
			minimum = abs(i - x) + abs(i - y) + abs(i - z)
		else:
			minimum = min(minimum, abs(i - x) + abs(i - y) + abs(i - z))
	stdout.write(str(minimum))
main()


lis = list((int(i) for i in input().split()))
lis.sort()
print(lis[2] - lis[0])


import sys
data = sys.stdin.readline()
(x, y, z) = data.split(' ')
x = int(x)
y = int(y)
z = int(z)
avg1 = abs(x - y) + abs(x - z)
avg2 = abs(y - x) + abs(y - z)
avg3 = abs(z - x) + abs(z - y)
smallest = min(avg1, avg2, avg3)
sys.stdout.write(str(smallest))


friends = sorted(list(map(int, input().split())))
print(friends[1] - friends[0] + friends[2] - friends[1])


s = [int(i) for i in input().split()]
i = 0
while i < len(s) - 1:
	if s[i] > s[i + 1]:
		(s[i], s[i + 1]) = (s[i + 1], s[i])
		i = -1
	i += 1
print(s[2] - s[0])


locations = [int(s) for s in input().split()]
print(max(locations) - min(locations))


(a, b, c) = [int(i) for i in input().split()]
print(max(abs(a - b), abs(a - c), abs(b - c)))


a = list(map(int, input().split()))
x = 0
for i in a:
	if i > min(a) and i < max(a):
		x += i
ans = max(a) - x + (x - min(a))
print(ans)


x = list(map(int, input().split()))
x.sort()
sum = len(x) // 2
count = 0
for i in range(len(x)):
	if sum < i:
		count += x[i] - x[sum]
	else:
		count += x[sum] - x[i]
print(count)


point = list(map(int, input().split(' ')))
point.sort()
print(point[1] - point[0] + (point[2] - point[1]))


(a, b, c) = map(int, input().split())
dif = [abs(a - b), abs(a - c), abs(b - c)]
print(sum(dif) - max(dif))


a = list(map(int, input().split()))
for i in range(1):
	c = abs(a[i + 1] - a[i]) + abs(a[i + 2] - a[i])
	d = abs(a[i + 1] - a[i]) + abs(a[i + 1] - a[i + 2])
	f = abs(a[i + 2] - a[i]) + abs(a[i + 2] - a[i + 1])
	print(min(c, d, f))


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nlargest, nsmallest, _heapify_max, _heapreplace_max
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from fractions import Fraction
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
arr = l()
arr.sort()
out(arr[2] - arr[0])


a = input()
b = map(lambda x: int(x), a.split(' '))
ma = 0
mi = 101
for i in b:
	if i > ma:
		ma = i
	if i < mi:
		mi = i
print(int(ma - mi))


(x, y, z) = map(int, input().split())
mn = min(x, y, z)
mx = max(x, y, z)
ans = 0
if x != mn and x != mx:
	ans = x
elif y != mn and y != mx:
	ans = y
else:
	ans = z
print(mx - ans + ans - mn)


(a, b, c) = sorted(map(int, input().split()))
m = a + c // 2
print(c - m + (m - a))


fr = sorted(list(map(int, input().split())))
print(fr[1] - fr[0] + (fr[2] - fr[1]))


alist = list(map(int, input().split()))
alist.sort()
print(abs(alist[0] - alist[1]) + abs(alist[-1] - alist[1]))


n = list(map(int, input().split()))
n.sort()
r = n[2] - n[1] + (n[1] - n[0])
print(r)


def s(n):
	if n > 0:
		return n
	if n < 0:
		return -n
m = 0
a = [int(i) for i in input().split()]
a.sort()
m = m + s(a[2] - a[1]) + s(a[0] - a[1])
print(m)


(x1, x2, x3) = list(map(int, input().split()))
a = [x1, x2, x3]
a.sort()
b = a.pop(2)
c = a.pop(1)
d = a.pop(0)
print(b - c + c - d)


d = [int(x) for x in input().split()]
print(max(d) - min(d))


(x, y, z) = map(int, input().split())
mi = min(x, y, z)
ma = max(x, y, z)
print(ma - mi)


def A723(arr):
	arr.sort()
	a = arr[1] - arr[0]
	b = arr[2] - arr[1]
	return a + b
array = input().strip().split(' ')
arr = []
for i in array:
	arr.append(int(i))
result = A723(arr)
print(result)


(x1, x2, x3) = map(int, input().split())
a = []
a.append(x1)
a.append(x2)
a.append(x3)
a.sort()
dist = a[1] - a[0] + (a[2] - a[1])
print(dist)


(x, y, z) = map(int, input().split())
m = max(x, y, z)
ans = m
k = 0
for i in range(m + 1):
	s = abs(i - x) + abs(i - y) + abs(i - z)
	if m >= s:
		m = s
		k = i
print(m)


l = sorted(list(map(int, input().split())))
mid = l[1]
print(abs(l[1] - l[0]) + abs(l[1] - l[2]))


n = list(map(int, input().split()))
n.sort()
c = n[2] - n[1] + (n[1] - n[0])
print(c)


s = [int(s) for s in input().split()]
m = (min(s) + max(s)) / 2
t = 0
n = 0
s.sort()
for i in range(len(s)):
	n += abs(s[i] - s[1])
print(int(n))


(a, b, c) = map(int, input().split())
x = max(a, b, c) - min(a, b, c)
print(x)


str_in = [int(x) for x in input().strip().split()]
print(max(str_in) - min(str_in))


houses = list(map(int, input().split()))
houses.sort()
dist = houses[1] - houses[0] + (houses[2] - houses[1])
print(dist)


spot = [int(i) for i in input().split()]
spot.sort()
print(spot[2] - spot[0])


x = list(map(int, input().split()))
x.sort()
totmd = x[1] - x[0] + (x[2] - x[1])
print(totmd)


coords = [*map(int, input().split())]
coords.sort()
size = len(coords)
dist = 0
mid = coords[size // 2]
for e in coords:
	dist += abs(e - mid)
print(dist)


import sys
x = list(map(int, sys.stdin.readline().split()))
vmax = 0
vmin = 100
for i in x:
	if i < vmin:
		vmin = i
	if i > vmax:
		vmax = i
print(vmax - vmin)


s = input().split()
s[0] = int(s[0])
s[1] = int(s[1])
s[2] = int(s[2])
s.sort()
print(int(s[1]) - int(s[0]) + (int(s[2]) - int(s[1])))


X = sorted(list(map(int, input().split())))
print(abs(X[2] - X[1]) + abs(X[1] - X[0]))


import math
s = input().split(' ')
l = [int(x) for x in s]
l.sort()
sh = int(math.fabs(l[1] - l[0]) + math.fabs(l[2] - l[1]))
print(sh)


import math as m
a = list(map(int, input().split()))
a.sort()
print(int(a[1]) - int(a[0]) + int(a[2]) - int(a[1]))


n = 3
N = [int(num) for num in input().split(' ', n - 1)]
N.sort()
print(N[2] - N[0])


p = [int(i) for i in input().split()]
print(max(p) - min(p))


a = list(map(int, input().split()))
Max = max(a)
Min = min(a)
del a[a.index(max(a))]
del a[a.index(min(a))]
print(Max - a[0] + abs(Min - a[0]))


points = list(map(int, input().split()))
left = min(points)
right = max(points)
mid = sum(points) - left - right
print(abs(mid - left) + abs(mid - right))


(x1, x2, x3) = map(int, input().split())
h = min(x1, x2, x3)
o = max(x1, x2, x3)
mi = abs(x1 - 1) + abs(x2 - 1) + abs(x3 - 1)
for i in range(h, o + 1):
	s = abs(x1 - i) + abs(x2 - i) + abs(x3 - i)
	if mi > s:
		mi = s
		I = i
print(mi)


a = [int(z) for z in input().split()]
a.sort()
print(abs(a[2] - a[0]))


(x, y, z) = [int(item) for item in input().split()]
(a, b, c) = (x, y, z)
(x, y, z) = (max(a, b, c), a + b + c - max(a, b, c) - min(a, b, c), min(a, b, c))
if x == y:
	print(x - z)
elif y == z:
	print(x - y)
else:
	print(abs(x - y) + abs(z - y))


str = input()
s = sorted(list(map(int, str.split(' '))))
print(abs(s[2] - s[0]))


b = [int(i) for i in input().split()]
k = 0
for i in b:
	if i < max(b) and i > min(b):
		mid = i
k += abs(max(b) - i)
k += abs(min(b) - i)
print(k)


(x1, x2, x3) = [int(x) for x in input().split()]
ans = 100
for pos in range(1, 101):
	total_diff = abs(pos - x1) + abs(pos - x2) + abs(pos - x3)
	ans = min(ans, total_diff)
print(ans)


n = list(map(int, input().split()))
count = 0
n.sort()
for i in range(len(n)):
	k = n[1]
	s = abs(n[i] - k)
	count = count + s
print(count)


(a, b, c) = input().split()
(a, b, c) = (int(a), int(b), int(c))
if max(a, b, c) == a:
	ma = a
elif max(a, b, c) == b:
	ma = b
else:
	ma = c
if min(a, b, c) == a:
	mi = a
	if ma == b:
		n = c
	else:
		n = b
elif min(a, b, c) == b:
	mi = b
	if ma == a:
		n = c
	else:
		n = a
else:
	mi = c
	if ma == b:
		n = a
	else:
		n = b
print(ma - mi)


a = []
(x1, x2, x3) = map(int, input().split())
a.append(int(x1))
a.append(int(x2))
a.append(int(x3))
maxi = max(a)
mini = min(a)
i = 0
for i in range(len(a)):
	if a[i] > mini and a[i] < maxi:
		mid = a[i]
s = maxi - mid + mid - mini
print(s)


s = [int(x) for x in input().split(' ')]
X = []
s.sort()
for i in range(1, 3):
	X.append(abs(s[i - 1] - s[i]))
print(sum(X))


arr = list(map(int, input().split()))
arr.sort()
ans = arr[2] - arr[0]
print(ans)


li = [int(x) for x in input().split()]
li.sort()
count = li[2] - li[1] + li[1] - li[0]
print(count)


s = set(map(int, input().split()))
print(max(s) - min(s))


import sys
f = [int(i) for i in input().split()]
f.sort()
result = 0
result += f[1] - f[0]
result += f[2] - f[1]
print(result)


points = list(map(int, input().split()))
print(max(points) - min(points))


import sys
import math
(a, b, c) = [int(x) for x in input().split()]
dst1 = (a - b) ** 2
dst2 = (b - c) ** 2
dst3 = (a - c) ** 2
print(f'{int(math.sqrt(max(dst1, dst2, dst3)))}')


def main():
	from sys import stdin, stdout
	(a, b, c) = stdin.readline().split()
	a = int(a)
	b = int(b)
	c = int(c)
	d = new_friend(a, b, c)
	stdout.write(str(d))

def new_friend(a, b, c):
	if a > b and b > c or (c > b and b > a):
		return abs(a - c)
	elif a > c and a > b or (a < c and a < b):
		return abs(a - b)
	else:
		return abs(b - c)
main()


import math
(home1, home2, home3) = (int(i) for i in input().split(' '))
travel1 = abs(home2 - home1) + abs(home3 - home1)
travel2 = abs(home1 - home2) + abs(home3 - home2)
travel3 = abs(home1 - home3) + abs(home2 - home3)
if travel1 <= travel2 and travel1 <= travel3:
	print(travel1)
elif travel2 < travel1 and travel2 <= travel3:
	print(travel2)
else:
	print(travel3)


def NewYear():
	a = list(map(int, input().split()))
	print(max(a) - min(a))
NewYear()


(a, b, c) = map(int, input().split())
lis = [a, b, c]
lis.sort()
print(lis[2] - lis[0])


d = list(map(int, input().split(' ')))
e = sorted(d)
print(e[1] - e[0] + (e[2] - e[1]))


def minimal_distance(points):
	points.sort()
	return points[2] - points[0]
print(minimal_distance(list(map(int, input().split()))))


(a, b, c) = input().split()
x = [int(a), int(b), int(c)]
x.sort()
i = x[1]
print(abs(i - x[0]) + abs(i - x[2]))


b = list(map(int, input().split()))
print(max(b) - min(b))


lst = list(map(int, input().split()))[:3]
lst.sort()
s1 = lst[1] - lst[0]
s2 = lst[2] - lst[1]
print(s1 + s2)


X = sorted(list(map(int, input().split())))
print(max([X[1] - X[0], X[2] - X[0], X[2] - X[1]]))


points = [int(x) for x in input().split()]
for i in range(3):
	for j in range(2 - i):
		if points[j] > points[j + 1]:
			(points[j], points[j + 1]) = (points[j + 1], points[j])
print(points[2] - points[0])


n = list(input().split(' '))
for i in range(0, 3):
	n[i] = int(n[i])
n.sort()
print(n[2] - n[1] + n[1] - n[0])


a = list(map(int, input().split()))
d = []
for i in a:
	s = 0
	for j in range(len(a)):
		if a[j] != i:
			s = s + abs(i - a[j])
	d.append(s)
print(min(d))


abcStr = input()
abcLine = abcStr.split()
abc = [0] * 3
for i in range(3):
	abc[i] = int(abcLine[i])
head = min(abc)
tail = max(abc)
print(tail - head)


a = [i for i in map(int, input().split())]
a.sort()
sum = 0
sum += a[1] - a[0]
sum += a[2] - a[1]
print(sum)


(a, b, c) = map(int, input().split())
d = int(a + b + c - max(a, b, c) - min(a, b, c))
print(d - min(a, b, c) + max(a, b, c) - d)


l = list(map(int, input().split()))
ma = max(l)
mi = min(l)
print(ma - mi)


spot = [int(x) for x in input().split()]
print(max(spot) - min(spot))


f = list(map(int, input().split()))
f = sorted(f)
print(f[2] - f[1] + (f[1] - f[0]))


li = list(map(int, input().split()))
print(max(li) - min(li))


xs = list(map(int, input().split()))
xs.sort()
s = xs[1] - xs[0] + (xs[2] - xs[1])
print(s)


a = list(map(int, input().split()))
g = []
g.append(abs(a[0] - a[1]) + abs(a[0] - a[2]))
g.append(abs(a[1] - a[0]) + abs(a[1] - a[2]))
g.append(abs(a[2] - a[0]) + abs(a[2] - a[1]))
print(min(g))


x = list(map(int, input().split()))
x.sort()
(a, b, c) = x
l = []
l = l + [abs(b - a) + abs(c - a)]
l = l + [abs(b - a) + abs(c - b)]
l = l + [abs(c - a) + abs(c - b)]
print(min(l))


a = input()
a = a.split()
b = list()
for x in a:
	b.append(int(x))
b.sort()
print(b[1] - b[0] + (b[2] - b[1]))


a = input()
b = a.split()
b.sort(key=float)
dist = 200
xn = int(b[0])
while xn <= int(b[2]):
	if abs(xn - int(b[0])) + abs(xn - int(b[1])) + abs(xn - int(b[2])) < dist:
		dist = abs(xn - int(b[0])) + abs(xn - int(b[1])) + abs(xn - int(b[2]))
	xn += 1
print(dist)


(a, b, c) = map(int, input().split())
if a > b and a < c or (a > c and a < b):
	r = abs(a - b) + abs(a - c)
elif b > a and b < c or (b < a and b > c):
	r = abs(b - a) + abs(b - c)
else:
	r = abs(c - a) + abs(c - b)
print(r)


li = list(map(int, input().split()))
li.sort()
(mi, n, ma) = (li[0], li[1], li[2])
c = n - mi + (ma - n)
print(c)


(a, b, c) = input().split()
a = int(a)
b = int(b)
c = int(c)
x = 0
d = []
d.append(a)
d.append(b)
d.append(c)
x = max(d) - min(d)
print(x)


(x1, x2, x3) = map(int, input().split())
if x2 > x1 and x2 < x3 or (x2 > x3 and x2 < x1):
	print(abs(x2 - x3) + abs(x2 - x1))
if x1 > x2 and x1 < x3 or (x1 > x3 and x1 < x2):
	print(abs(x1 - x3) + abs(x2 - x1))
if x3 > x1 and x3 < x2 or (x3 > x2 and x3 < x1):
	print(abs(x2 - x3) + abs(x3 - x1))


n1 = list(map(int, input().split()))
n1 = sorted(n1)
n2 = abs(n1[1] - n1[0]) + abs(n1[1] - n1[2])
n2 = int(n2)
print(n2)


a = list(input().split())
s = int(a[0]) + int(a[1]) + int(a[2]) - min(min(int(a[0]), int(a[1])), int(a[2])) - max(max(int(a[0]), int(a[1])), int(a[2]))
print(abs(s - int(a[0])) + abs(s - int(a[1])) + abs(s - int(a[2])))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
l = inlt()
l.sort()
n = l[2] - l[0]
print(n)


a = map(int, input().split())
l = []
for j in a:
	l.append(j)
mx = max(l)
mn = min(l)
for i in l:
	if i < mx and i > mn:
		md = i
ans = mx - md + (md - mn)
print(ans)


def solve():
	mas = sorted([int(s) for s in input().split()])
	ans = 0
	for i in range(1, len(mas)):
		ans += mas[i] - mas[i - 1]
	print(ans)
solve()


(a, b, c) = (int(x) for x in input().split(' '))
if a < b:
	t = a
	a = b
	b = t
if b < c:
	t = b
	b = c
	c = t
if a > b:
	print('%d' % (a - c))
else:
	print('%d' % (b - c))


coordinates = sorted((int(x) for x in input().split()))
dist_a = coordinates[1] - coordinates[0]
dist_b = coordinates[2] - coordinates[1]
print(dist_a + dist_b)


arr = list(map(int, input().rstrip().split()))
arr.sort()
print(arr[1] - arr[0] + (arr[2] - arr[1]))


s = sorted(list(map(int, input().split())))
tot = 0
for i in s:
	tot += abs(i - s[1])
print(tot)


list = [int(x) for x in input().split(' ')]
list.sort()
print(list[2] - list[1] + list[1] - list[0])


l = sorted(map(int, input().split()))
print(l[1] - l[0] + (l[2] - l[1]))


import math
import itertools
gh = lambda : map(int, input().split())
mod = 998244353
mod = int(mod)

def main():
	(x, y, z) = gh()
	mean = (x + y + z) // 3
	t = abs(x - mean) + abs(y - mean) + abs(z - mean)
	mean = x
	t1 = abs(x - mean) + abs(y - mean) + abs(z - mean)
	t = min(t1, t)
	mean = y
	t1 = abs(x - mean) + abs(y - mean) + abs(z - mean)
	t = min(t1, t)
	mean = z
	t1 = abs(x - mean) + abs(y - mean) + abs(z - mean)
	print(min(t1, t))
main()


def calc(x):
	return x[1] - x[0] + (x[2] - x[1])
x = list(map(int, input().split()))
x.sort()
print(calc(x))


(a, b, c) = map(int, input().split())
while a < 1 or a > 100:
	a = int(input())
while b < 1 or b > 100:
	b = int(input())
while c < 1 or c > 100:
	c = int(input())
mi = min(a, b, c)
ma = max(a, b, c)
allsu = []
for i in range(mi, ma):
	a1 = abs(a - i)
	b1 = abs(b - i)
	c1 = abs(c - i)
	sum1 = a1 + b1 + c1
	allsu.append(sum1)
print(min(allsu))


from sys import stdin as fin
(a, b, c) = sorted(map(int, fin.readline().split()))
print(c - a)


x = input('').split()
list = []
for c in range(len(x)):
	list.append(int(x[c]))
list.sort()
output = list[len(x) - 1] - list[0]
print(output)


import math
(a, b, c) = map(int, input().split())
l = [a, b, c]
l.sort()
print(l[2] - l[0])


l = [int(ele) for ele in input().split()]
l.sort()
print(l[2] - l[0])


l = list(map(int, input().split()))
l.sort()
sum = l[1] - l[0] + (l[2] - l[1])
print(sum)


(a, b, c) = input().split(' ')
ll = [int(a), int(b), int(c)]
ll.sort()
z = abs(int(ll[1]) - int(ll[0])) + abs(int(ll[2]) - int(ll[1]))
print(z)


def meetup(arr):
	return max(arr) - min(arr)
x = list(map(int, input().rstrip().split()))
print(meetup(x))


import math
(k, l, m) = map(int, input().split())
c1 = abs(k - l)
c2 = abs(k - m)
c3 = abs(l - m)
s = c1 + c2
min = s
if c1 + c3 < min:
	min = c1 + c3
if c2 + c3 < min:
	min = c2 + c3
print(min)


(x1, x2, x3) = list(map(int, input().split()))
l = min(x1, x2, x3)
n = max(x1, x2, x3)
m = x1 + x2 + x3 - (l + n)
s = (x1 + x2 + x3) // 3
ans = abs(s - x1) + abs(s - x2) + abs(s - x3)
ans1 = abs(l - m) + abs(m - n)
print(min(ans, ans1))


arr = list(map(int, input().split()))
mx = max(arr)
mi = min(arr)
print(mx - mi)


l1 = list(map(int, input().strip().split()))
l1.sort()
min = l1[1] - l1[0] + (l1[2] - l1[1])
print(min)


(a, b, c) = map(int, input().split())
list1 = []
list1.append(abs(a - b) + abs(a - c))
list1.append(abs(a - b) + abs(b - c))
list1.append(abs(c - b) + abs(a - c))
print(min(list1))


from sys import stdin, stdout

def main():
	line = stdin.readline()
	parts = line.split()
	f1 = int(parts[0])
	f2 = int(parts[1])
	f3 = int(parts[2])
	rta = 0
	if f1 >= f2 and f1 <= f3:
		rta = f1 - f2 + (f3 - f1)
	elif f1 <= f2 and f1 >= f3:
		rta = f2 - f1 + (f1 - f3)
	elif f2 >= f1 and f2 <= f3:
		rta = f2 - f1 + (f3 - f2)
	elif f2 <= f1 and f2 >= f3:
		rta = f1 - f2 + (f2 - f3)
	elif f3 >= f1 and f3 <= f2:
		rta = f3 - f1 + (f2 - f3)
	elif f3 <= f1 and f3 >= f2:
		rta = f1 - f3 + (f3 - f2)
	stdout.write(str(rta))
main()


ar = [int(i) for i in input().strip().split()]
ar.sort()
ans = 0
ans += ar[1] - ar[0]
ans += ar[2] - ar[1]
print(ans)


p = list(map(int, input().split()))
print(max(p) - min(p))


(a, b, c) = map(int, input().split())
Minim = 0
idx = 0
for i in range(1, 101):
	tmp = abs(a - i) + abs(b - i) + abs(c - i)
	if i == 1 or Minim > tmp:
		Minim = tmp
		idx = i
print(Minim)


data = [int(x) for x in input().split()]
print(max(data) - min(data))


a = input()
a = a.split()
x1 = int(a[0])
x2 = int(a[1])
x3 = int(a[2])
s = [x1, x2, x3]
print(max(s) - min(s))


(x1, x2, x3) = map(int, input().split())
meet = 0
for i in range(101):
	if abs(x1 - i) + abs(x2 - i) + abs(x3 - i) < abs(x1 - meet) + abs(x2 - meet) + abs(x3 - meet):
		meet = i
print(abs(x1 - meet) + abs(x2 - meet) + abs(x3 - meet))


(x1, x2, x3) = map(int, input().split())
l = [abs(x1 - x2), abs(x2 - x3), abs(x3 - x1)]
l.sort()
print(l[0] + l[1])


l = sorted(list(map(int, input().strip().split())))
print(l[2] - l[1] + (l[1] - l[0]))


(x, y, z) = map(int, input().split())
l = [x, y, z]
l.sort()
s = abs(l[0] - l[1]) + abs(l[1] - l[2])
print(s)


def _min_r_(l_s):
	kol = int(l_s[2]) - int(l_s[1]) + (int(l_s[1]) - int(l_s[0]))
	return kol
(a, b, c) = map(int, input().split())
l_s = []
l_s += (a, b, c)
l_s = sorted(l_s)
print(_min_r_(l_s))


(a, b, c) = [int(i) for i in input().split()]
mia = abs(c - a) + abs(b - a)
mib = abs(a - b) + abs(c - b)
mic = abs(a - c) + abs(b - c)
print(min(mia, min(mib, mic)))


(a, b, c) = sorted([int(i) for i in input().split()])
output = 0
output += b - a
output += c - b
print(output)


import math
(x1, x2, x3) = input().split()
(x1, x2, x3) = (int(x1), int(x2), int(x3))
AB = math.sqrt((x1 - x2) ** 2)
AB = int(AB)
BC = math.sqrt((x2 - x3) ** 2)
BC = int(BC)
AC = math.sqrt((x3 - x1) ** 2)
AC = int(AC)
print(max(AB, BC, AC))


e = input().split()
a = int(e[0])
b = int(e[1])
c = int(e[2])
if a > b and b > c:
	d = a - c
elif a > c and c > b:
	d = a - b
elif b > a and a > c:
	d = b - c
elif b > c and c > a:
	d = b - a
elif c > a and a > b:
	d = c - b
elif c > b and b > a:
	d = c - a
print(d)


lst = list(map(int, input().split()))
lst = sorted(lst)
print(lst[1] - lst[0] + (lst[2] - lst[1]))


I = lambda : map(int, input().split())
(a, b, c) = I()
print(max(a, b, c) - min(a, b, c))


(a, b, c) = [int(x) for x in input().split()]
l = []
l.append(a)
l.append(b)
l.append(c)
for i in range(0, 3):
	if l[i] != max(l) and l[i] != min(l):
		print(max(l) - min(l))


people = list(map(int, input().split()))
people.sort()
print(abs(people[0] - people[1]) + abs(people[2] - people[1]))


import sys
(x1, x2, x3) = map(int, sys.stdin.readline().split())
xmax = max(x1, x2, x3)
xmin = min(x1, x2, x3)
print(xmax - xmin)


l = list(map(int, input().split()))
mn = min(l)
mx = max(l)
ans = (mn + mx) // 2
an = 0
an += abs(ans - mn) + abs(ans - mx)
print(an)


(a, b, c) = input('').split(' ')
(a, b, c) = (int(a), int(b), int(c))
l = [a, b, c]
l.sort()
k = l[1]
d = max(l) - k + k - min(l)
print(d)


points = [int(x) for x in input().split()]
points.sort()
distance = points[1] - points[0] + (points[2] - points[1])
print(distance)


import math
from collections import Counter

def get(f):
	return map(f, input().split())

def main():
	(a, b, c) = sorted(get(int))
	print(c - a)
main()


cords = list(map(int, input().split(' ')))
cords.sort()
print(sum([abs(cords[1] - cords[0]), abs(cords[1] - cords[2])]))


x = input().split()
for i in range(0, 3):
	x[i] = int(x[i])
x = sorted(x)
print(x[2] - x[1] + x[1] - x[0])


lst = list((int(num) for num in input().split()))[:3]
x = max(lst) - min(lst)
if x >= 0:
	print(x)
else:
	print(-1 * x)


(a, b, c) = input().split()
(a, b, c) = (int(a), int(b), int(c))
print(min(abs(a - b) + abs(a - c), abs(b - c) + abs(b - a), abs(c - a) + abs(c - b)))


(n1, n2, n3) = map(int, input().split())
a = min(abs(n2 - n1) + abs(n3 - n1), abs(n1 - n2) + abs(n3 - n2), abs(n1 - n3) + abs(n2 - n3))
print(a)


places = [int(x) for x in input().split()]
print(max(places) - min(places))


(x, y, z) = list(map(int, input().split()))
print(max(x, y, z) - min(x, y, z))


(A, B, C) = input().split()
LISTA = []
A = int(A)
LISTA.append(A)
B = int(B)
LISTA.append(B)
C = int(C)
LISTA.append(C)
LISTA.sort()
DISTANCIA = abs(LISTA[0] - LISTA[1]) + abs(LISTA[2] - LISTA[1])
print(DISTANCIA)


points = [int(a) for a in input().split()]
point1 = abs(points[1] - points[0]) + abs(points[2] - points[0])
point2 = abs(points[0] - points[1]) + abs(points[2] - points[1])
point3 = abs(points[1] - points[2]) + abs(points[0] - points[2])
print(min(point1, point2, point3))


listt = list(map(int, input().split()))
res = 0
listt.sort()
diff1 = listt[1] - listt[0]
diff2 = listt[2] - listt[1]
res = diff1 + diff2
print(res)


a = list(map(int, input().split()))
a.sort()
count = 0
mid = a[1]
while a[2] > mid:
	count += 1
	a[2] -= 1
while mid > a[0]:
	count += 1
	a[0] += 1
print(count)


list1 = list(map(int, input().split()))
list1.sort()
print(list1[1] - list1[0] + (list1[2] - list1[1]))


import sys
(a, b, c) = map(int, input().split())
res = sys.maxsize
for i in range(1, 101):
	res = min(res, abs(i - a) + abs(i - b) + abs(i - c))
print(res)


def r(t=int):
	return list(map(t, input().split()))

def ri(t=int):
	return t(input())

def cd(it):
	ret_val = dict()
	for v in it:
		ret_val[v] = ret_val.get(v, 0) + 1
	return ret_val
f = r()
ans = max(f) - min(f)
print(ans)


a = list(map(int, input().split()))
a.sort()
d1 = a[1] - a[0]
d2 = a[2] - a[1]
print(d1 + d2)


distance = list(map(int, input().split()))
distance.sort()
sum = distance[1] - distance[0] + (distance[2] - distance[1])
print(sum)


nums = [int(x) for x in input().split()]
nums.sort()
ans = nums[1] - nums[0] + (nums[2] - nums[1])
print(ans)


n = list(map(int, input().split()))
x = (max(n) + min(n)) / 2
print(int(max(n) - x + (x - min(n))))


list1 = list(map(int, input().split()))
print(max(list1) - min(list1))


l = list(map(int, input().split()))
a = max(l)
b = min(l)
s = a - b
print(s, end='')


line = list(map(int, input().split()))
print(max(line) - min(line))


s = list(map(int, input().split()))
s.sort()
print(s[2] - s[0])


(n, m, k) = map(int, input().split())
j = m + n + k - max(n, m, k) - min(n, m, k)
print(abs(n - j) + abs(m - j) + abs(k - j))


entrada = input()
entrada = entrada.strip().split()
entrada = list(map(int, entrada))
entrada = sorted(entrada)
min = entrada[0]
entrada = list(map(lambda x: x - min, entrada))
print(entrada[2])


puntos = sorted(list(map(int, input().split())))
print(puntos[1] - puntos[0] + (puntos[2] - puntos[1]))


n1 = list(map(int, input().split()))
print(max(n1) - min(n1))


x = []
x[:] = map(int, input().split())
x.sort()
print(x[2] - x[1] + (x[1] - x[0]))


(n, k, m) = map(int, input().split())
print(abs(n - k) + abs(n - m) + abs(m - k) - max((abs(n - k), abs(n - m), abs(m - k))))


(n, m, k) = map(int, input().split())
print(max(n, m, k) - min(m, n, k))


abc = list(map(int, input().split()))
abc.sort()
(a, b, c) = abc
print(c - a)


(a, b, c) = map(int, input().split())
a1 = abs(b - a) + abs(c - a)
b1 = abs(a - b) + abs(c - b)
c1 = abs(c - a) + abs(c - b)
print(min(a1, b1, c1))


(a, b, c) = map(int, input().split())
(x, y, dist) = (min(a, b, c), max(a, b, c), 101)
for i in range(x, y + 1):
	dist = min(dist, abs(a - i) + abs(b - i) + abs(c - i))
print(dist)


a = list(map(int, input().split()))
b = a[:]
b.sort()
z = b[2] - b[1]
m = b[1] - b[0]
n = m + z
print(n)


p = input()
p = p.split()
for i in range(3):
	p[i] = int(p[i])
p.sort()
print(p[2] - p[0])


ks = sorted(list(map(int, input().split())))
print(ks[-1] - ks[0])


a = sorted([*map(int, input().split())])
print(abs(a[0] - a[1]) + a[2] - a[1])


lst = list(map(int, input().split()))
lst.sort()
result = lst[2] - lst[0]
print(result)


a = list(map(int, input().split()))
x = min(a)
y = max(a)
print(y - x)


l = [*map(int, input().split())]
res = float('inf')
for i in range(1, 101):
	res = min(res, sum((abs(e - i) for e in l)))
print(res)


from sys import stdin
a = [int(x) for x in stdin.readline().split()]
d1 = abs(a[0] - a[1]) + abs(a[0] - a[2])
d2 = abs(a[1] - a[0]) + abs(a[1] - a[2])
d3 = abs(a[2] - a[0]) + abs(a[2] - a[1])
print(min(d1, d2, d3))


coo = [int(i) for i in input().split()]
coo.sort()
total = 100000
for i in range(coo[0], coo[2] + 1):
	a = abs(coo[0] - i) + abs(coo[1] - i) + abs(coo[2] - i)
	if a < total:
		total = a
print(total)


nums = map(int, input().split())
nums = sorted(nums)
min_dist = abs(nums[1] - nums[0]) + abs(nums[1] - nums[2])
print(min_dist)


a = sorted(map(int, input().split()))
c = a[1] - a[0] + (a[2] - a[1])
print(c)


(a1, a2, a3) = input().split()
a1 = int(a1)
a2 = int(a2)
a3 = int(a3)
if a3 > a2:
	c = a2
	a2 = a3
	a3 = c
if a2 > a1:
	c = a1
	a1 = a2
	a2 = c
if a3 > a2:
	c = a2
	a2 = a3
	a3 = c
print(a1 - a3)


house = [int(x) for x in input().split()]
house = sorted(house)
print(house[2] - house[0])


while True:
	try:
		num = input().split()
		for i in range(len(num)):
			num[i] = int(num[i])
		num.sort()
		sum = num[1] - num[0] + (num[2] - num[1])
		print(sum)
	except:
		break


(a, b, c) = map(int, input().split())
min_v = a
max_v = a
avg_v = a
if b > max_v:
	max_v = b
if b < min_v:
	min_v = b
if c > max_v:
	max_v = c
if c < min_v:
	min_v = c
avg_v = a + b + c - max_v - min_v
print(max_v - min_v)


k = list(map(int, input().split()))
k = sorted(k)
t = k[1] - k[0]
m = k[2] - k[1]
print(t + m)


def main():
	list1 = list(map(int, input().split(' ')))
	list1.sort()
	a = list1[0]
	b = list1[1]
	c = list1[2]
	list1.clear()
	list1.append(b - a + (c - a))
	list1.append(b - a + (c - b))
	list1.append(c - a + (c - b))
	print(min(list1))
main()


s = [int(i) for i in input().split()]
s.sort()
a = s[2] + s[1] - 2 * s[0]
b = s[2] - s[1] + s[1] - s[0]
c = s[2] - s[1] + s[2] - s[0]
print(min(a, b, c))


import math
import sys
import string

def ri():
	return input()

def ii():
	return int(input())

def li():
	return input().split()

def mi():
	return list(map(int, input().split()))
h = mi()
h.sort()
print(abs(h[0] - h[1]) + abs(h[1] - h[2]))


i = list(map(int, input().split(' ')))
print(max(i) - min(i))


from sys import stdin, stdout
inp = stdin.readline
out = stdout.write
(x1, x2, x3) = sorted(map(int, inp().strip().split()))
print(x3 - x1)


a = input().split()
a = list(map(int, a))
a = sorted(a)
m = a[2] - a[0]
print(m)


list1 = sorted(list(map(int, input().split())))
print(list1[2] - list1[0])


friends = list(map(int, input().split()))
friends.sort()
r = abs(friends[0] - friends[1]) + abs(friends[2] - friends[1])
print(r)


lst = list(map(int, input().strip().split(' ')))
lst.sort()
if lst[0] == lst[1] and lst[1] != lst[2]:
	print(lst[2] - lst[0])
elif lst[1] == lst[2] and lst[0] != lst[1]:
	print(lst[2] - lst[0])
else:
	x = lst[1]
	a = abs(x - lst[0])
	b = abs(x - lst[2])
	print(int(a + b))


arr = []
arr = list(map(int, input().split()))
x1 = max(arr)
arr.remove(x1)
x3 = min(arr)
arr.remove(x3)
x2 = arr[0]
ans = x1 - x2 + abs(x3 - x2)
print(ans)


from math import ceil, floor

def map_input(type=1):
	if type == 1:
		return map(int, input().split())
	elif type == 2:
		return map(float, input().split())
	elif type == 3:
		return map(str, input().split())
	return None

def list_input(type=1):
	return list(map_input(type))

def give_excel_column_name(r: int):
	l = 1
	r -= 1
	ans: str = ''
	while 26 ** l <= r:
		r -= 26 ** l
		l += 1
	while l > 0:
		ans += chr(ord('A') + r // 26 ** (l - 1) % 26)
		l -= 1
	return ans

def give_excel_column_number(name: str):
	p = 1
	ans: int = 0
	for j in range(len(name)):
		ans = ans + p * (ord(name[j]) - ord('A') + 1)
		p = p * 26
	return ans

def sorted_indices(s):
	li = []
	for i in range(len(s)):
		li.append([s[i], i])
	li.sort()
	return [x[1] for x in li]

def floorSearch(arr, x, low=-1, high=-1):
	if low == -1:
		low = 0
	if high == -1:
		high == len(arr) - 1
	if low > high:
		return -1
	if x >= arr[high]:
		return high
	mid = int((low + high) / 2)
	if arr[mid] == x:
		return mid
	if mid > 0 and arr[mid - 1] <= x and (x < arr[mid]):
		return mid - 1
	if x < arr[mid]:
		return floorSearch(arr, low, mid - 1, x)
	return floorSearch(arr, mid + 1, high, x)

def find_index(arr, x):
	low = 0
	high = len(arr) - 1
	mid = 0
	while low <= high:
		mid = (high + low) // 2
		if arr[mid] < x:
			low = mid + 1
		elif arr[mid] > x:
			high = mid - 1
		else:
			return mid
	return -1

def floyd_warshell(g):
	n = len(g)
	d = g.copy()
	for k in range(n):
		for i in range(n):
			for j in range(n):
				d[i][j] = min(d[i][j], d[i][k] + d[k][j])
	return d

def int_input(type=1):
	if type == 1:
		return int(input())
	elif type == 2:
		return float(int(input()))

def range_input():
	return range(int_input())

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def is_prime(n):
	if n < 2:
		return False
	if n == 2:
		return True
	for i in range(2, int(n / 2) + 1):
		if n % i == 0:
			return False
	return True

def average(l):
	return sum(l) / len(l)

def main():
	l = sorted(list_input())
	print(l[-1] - l[0])
	return
	n = [average(l[:2]), average(l[1:]), average(l[::2])]
	g = l.copy()
	for i in n:
		g.extend([ceil(i), floor(i)])
	ans = []
	for i in g:
		tmp = 0
		avg = int(i)
		for j in l:
			tmp += abs(i - j)
		ans.append(tmp)
	print(int(min(ans)))
try:
	main()
except:
	pass


lista = input().split(' ')

def main(lista):
	min_dists = 1000
	min_dist = 0
	prin_house = 0
	for i in lista:
		i = int(i)
		for b in lista:
			b = int(b)
			min_dist += abs(b - i)
		if min_dist < min_dists:
			min_dists = min_dist
			prin_house = i
		min_dist = 0
	print(min_dists)
main(lista)


x = list(map(int, input().split()))
x.sort()
y = []
i = x[2] + x[1] - 2 * x[0]
y.append(i)
d = x[2] - x[1] + x[2] - x[0]
y.append(d)
f = x[1] - x[0] + x[2] - x[1]
y.append(f)
y.sort()
y.reverse()
print(y.pop())


a = list(map(int, input().split()))
t = max(a)
u = min(a)
b = []
for i in range(u, t + 1):
	o = abs(a[0] - i) + abs(a[1] - i) + abs(a[2] - i)
	b.append(o)
print(min(b))


x = input().split()
y = [int(i) for i in x]
y.sort()
print(y[2] - y[0])


(a, b, c) = map(int, input().split())
l = [a, b, c]
l.sort()
x = l[0]
y = l[1]
z = l[2]
ans = 0
ans += y - x
ans += z - y
print(ans)


arr = [int(__) for __ in input().strip().split()]
print(max(arr) - min(arr))


(a, b, c) = map(int, input().split())
print(min([abs(a - i) + abs(b - i) + abs(c - i) for i in range(100)]))


l = list((int(x) for x in input().strip().split(' ')))
l.sort()
d1 = l[2] - l[1]
d2 = l[1] - l[0]
print(d1 + d2)


dist = [int(i) for i in input().split()]
meet = int(''.join([str(i) for i in dist if i != max(dist) and i != min(dist)]))
print(sum([abs(i - meet) for i in dist]))


a = list(map(int, input().split()))
l = []
for i in range(3):
	b = 0
	for j in range(3):
		s = a[i] - a[j]
		if s > 0:
			b = b + s
		else:
			b = b + -1 * s
	l.append(b)
print(min(l))


(x, y, z) = map(int, input().split())
l = [x, y, z]
big = max(l)
small = min(l)
dis = 0
for i in l:
	if i != big and i != small:
		dis = dis + (big - i) + (i - small)
print(dis)


(x1, x2, x3) = map(int, input().split(' '))
l = [x1, x2, x3]
l.sort()
s1 = l[2] - l[0] + l[1] - l[0]
s2 = l[2] - l[1] + l[1] - l[0]
s3 = l[2] - l[0] + l[2] - l[1]
print(min(s1, s2, s3))


loc = [int(x) for x in input().split()]
distance = []
for i in range(min(loc), max(loc) + 1):
	a = 0
	for x in loc:
		a += abs(x - i)
	distance.append(a)
print(min(distance))


l = list(map(int, input().split()))
l.sort()
s = 0
for i in range(len(l) - 1):
	s += l[i + 1] - l[i]
print(s)


I = [int(i) for i in input().split()]
for i in range(len(I)):
	for j in range(i, len(I)):
		if I[i] > I[j]:
			(I[i], I[j]) = (I[j], I[i])
steps = I[1] - I[0] + I[2] - I[1]
print(steps)


(x1, x2, x3) = map(int, input().split())
v1 = max(x1, x2, x3)
v2 = min(x1, x2, x3)
v3 = x1 + x2 + x3 - (v1 + v2)
v5 = v1 - v3
v6 = v3 - v2
v = v5 + v6
print(v)


(a, b, c) = sorted(map(int, input().split()))
mdis = a + b + c
for i in range(a, c + 1):
	dis = abs(a - i) + abs(b - i) + abs(c - i)
	if dis < mdis:
		mdis = dis
print(mdis)


str = input()
list = str.split(' ')
s1 = int(list[0])
s2 = int(list[1])
s3 = int(list[2])
if s1 > s2:
	(s1, s2) = (s2, s1)
if s2 > s3:
	(s2, s3) = (s3, s2)
if s1 > s2:
	(s1, s2) = (s2, s1)
print(s3 - s2 + s2 - s1)


x = list(map(int, input().split()))
x.sort()
ma = 1000
for i in range(x[0], x[2]):
	dec = i - x[0] + abs(i - x[1]) + (x[2] - i)
	if dec < ma:
		ma = dec
print(ma)


import sys
import math

def main():
	stdin = [int(x) for x in sys.stdin.read().split()]
	min_tot_dist(stdin)

def min_tot_dist(A):
	min_dist = math.inf
	for a in A:
		temp = sum([abs(x - a) for x in A])
		min_dist = min(min_dist, temp)
	print(min_dist)
main()


s = list(map(int, input().split()))
s.sort()
ans = 1000
for t in range(s[0], s[2] + 1):
	v = abs(t - s[0]) + abs(t - s[1]) + abs(t - s[2])
	if v < ans:
		ans = v
print(ans)


import sys
f = sys.stdin
a = list(map(int, f.readline().split()))
a.sort()
print(a[2] - a[0])


(a, b, c) = map(int, input().split())
if a > b:
	d = a
	a = b
	b = d
if b > c:
	d = b
	b = c
	c = d
if a > b:
	d = a
	a = b
	b = d
print(c - a)


p = sorted(list(map(int, input().split())))
print(p[2] - p[0])


positions = input()
xl = []
j = 0
for i in range(len(positions)):
	if positions[i] == ' ':
		xl.append(int(positions[j:i]))
		j = i + 1
xl.append(int(positions[j:]))
xl.sort()
distance = []
distance.append(xl[1] - xl[0] + xl[2] - xl[0])
distance.append(xl[1] - xl[0] + xl[2] - xl[1])
distance.append(xl[2] - xl[0] + xl[2] - xl[1])
distance.sort()
answer = distance[0]
print(answer)


a = input().split()
a1 = int(a[0])
a2 = int(a[1])
a3 = int(a[2])
print(max(a1, a2, a3) - min(a1, a2, a3))


m = 3
X = [int(m) for m in input().split(' ')]
X = sorted(X)
out = 0
for i in range(m):
	out += abs(X[-1] - X[0])
out = out / m
print(int(out))


import sys
a = []
for line in sys.stdin:
	line = line.strip()
	temp = line.split(' ')
	for x in temp:
		a.append(int(x))
best = 1000000
for i in range(0, 100):
	sum = 0
	for x in a:
		sum += abs(x - i)
	best = min(sum, best)
print(best)


p = [int(i) for i in input().split()]
p.sort()
best = 100000
for i in range(101):
	best = min(best, abs(i - p[0]) + abs(i - p[1]) + abs(i - p[2]))
print(best)


a = [int(x) for x in input().split()]
a.sort()
p = []
for i in range(a[0], a[-1]):
	x = abs(i - a[0]) + abs(i - a[1]) + abs(i - a[2])
	p.append(x)
p.sort()
print(p[0])


line = input()
strings = line.split()
list = []
for each in strings:
	list.append(eval(each))
list.sort()
print(list[-1] - list[0])


a = [0] * 3
a = input().split()
a = [int(i) for i in a]
print(max(a) - min(a))


coords = list(map(int, input().split()))
coords.sort()
print(coords[2] - coords[0])


(x1, x2, x3) = map(int, input().split())
y = []
y.append(abs(x2 - x1) + abs(x3 - x1))
y.append(abs(x1 - x2) + abs(x3 - x2))
y.append(abs(x1 - x3) + abs(x2 - x3))
print(min(y))


(a, b, c) = map(int, input().split())
aa = abs(b - a) + abs(a - c)
bb = abs(a - b) + abs(b - c)
cc = abs(a - c) + abs(b - c)
print(min(aa, bb, cc))


(x1, x2, x3) = map(int, input().split())
mi = min(x1, x2, x3)
na = max(x1, x2, x3)
S = x1 + x2 + x3 - mi - na
V = S - mi + na - S
print(V)


l = list(map(int, input().split()))
ans = 1000000000.0
for i in range(101):
	ans = min(ans, abs(l[0] - i) + abs(l[1] - i) + abs(l[2] - i))
print(ans)


def meetingFriends():
	values = input().split()
	values = sorted([int(i) for i in values])
	print(values[2] - values[0])
meetingFriends()


n = list(map(int, input().split()))
for i in range(3):
	min = n[i]
	jmin = i
	for j in range(i + 1, 3):
		if n[j] < min:
			jmin = j
			min = n[j]
	(n[jmin], n[i]) = (n[i], min)
dis = abs(n[2] - n[1]) + abs(n[0] - n[1])
print(dis)


h = [int(i) for i in input().split()]
h.sort()
hmin = min(h)
hmax = max(h)
i = hmin
min_dist = 500
while i <= hmax:
	first = abs(h[0] - i)
	second = abs(h[1] - i)
	third = abs(h[2] - i)
	tot = first + second + third
	if tot < min_dist:
		min_dist = tot
	i += 1
print(min_dist)


line = input().split()
c1 = int(line[0])
c2 = int(line[1])
c3 = int(line[2])
ans = max(c1, c2, c3) - min(c1, c2, c3)
print(str(ans))


(a, b, c) = map(int, input().strip().split())
min_r_a = 1000
for i in range(1, 101):
	r_a = abs(a - i) + abs(b - i) + abs(c - i)
	min_r_a = min(r_a, min_r_a)
print(min_r_a)


a = list(map(int, input().split()))
a.sort()
total = a[1] - a[0] + a[2] - a[1]
print(total)


x = list(map(int, input().split()))
x2 = x.pop(x.index(min(x)))
x3 = x.pop(x.index(max(x)))
x = x.pop()
print(x - x2 + x3 - x)


(x1, x2, x3) = list(map(int, input().split()))
if x2 < x1:
	aux = x1
	x1 = x2
	x2 = aux
if x3 < x1:
	aux = x1
	x1 = x3
	x3 = aux
if x3 < x2:
	aux = x3
	x3 = x2
	x2 = aux
maior = x3
menor = x1
centro = x2
dist = 0
for casa in [x1, x2, x3]:
	dist += abs(centro - casa)
print(dist)


xs = [int(x) for x in input().split()]
print(max(xs) - min(xs))


(x1, x2, x3) = map(int, input().split())
min1 = float('inf')
for i in range(min(x1, x2, x3), max(x1, x2, x3) + 1):
	w = abs(i - x1) + abs(i - x2) + abs(i - x3)
	if min1 > w:
		min1 = w
print(min1)


n = [int(x) for x in input().split()]
a = min(n)
b = max(n)
print(b - a)


(n, m, k) = map(int, input().split())
mi = min(n, m, k)
ma = max(n, m, k)
dis = int(100000.0)
po = -1
for i in range(mi, ma + 1):
	if abs(i - n) + abs(i - m) + abs(i - k) < dis:
		po = i
		dis = abs(i - n) + abs(i - m) + abs(i - k)
print(dis)


k = [int(x) for x in input().split()]
k.sort()
d = k[1] - k[0] + (k[2] - k[1])
print(d)


(a, b, c) = map(int, input().split(' '))
ab = abs(a - b)
ac = abs(a - c)
bc = abs(b - c)
print(min(ac + bc, min(ab + ac, ab + bc)))


import sys
n = list(map(int, input().split()))
n = sorted(n)
result = n[1] - n[0] + n[-1] - n[1]
print(result)


n = input().split()
x1 = int(n[0])
x2 = int(n[1])
x3 = int(n[2])
big = 0
sma = 0
if x1 >= x2 and x1 >= x3:
	big = x1
elif x2 >= x1 and x2 >= x3:
	big = x2
else:
	big = x3
if x1 <= x2 and x1 <= x3:
	sma = x1
elif x2 <= x1 and x2 <= x3:
	sma = x2
else:
	sma = x3
mymin = big
for i in range(sma, big + 1):
	mysum = abs(i - x1) + abs(i - x2) + abs(i - x3)
	if mysum < mymin:
		mymin = mysum
print(mymin)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 10
mod = 10 ** 9 + 7

def f():
	a = list(map(int, input().split()))
	a.sort()
	return a[1] - a[0] + a[2] - a[1]
print(f())


a = list(map(int, input().split()))
a.sort()
dist = a[1] - a[0] + (a[2] - a[1])
print(dist)


def main():
	a = list(map(int, input().split()))
	print(max(a) - min(a))
main()


n = list(map(int, input().split()))
n.sort()
b = n[2] - n[1] + (n[1] - n[0])
print(b)


(a, b, c) = map(int, input().split())
mx = max(a, b, c)
mn = min(a, b, c)
res = 100
for i in range(mn, mx + 1):
	temp = abs(i - a) + abs(i - b) + abs(i - c)
	if temp < res:
		res = temp
print(res)


def abs(n):
	if n < 0:
		return n * -1
	else:
		return n
str = input()
l = str.split()
for i in range(3):
	l[i] = int(l[i])
l.sort()
n1 = l[0]
n2 = l[1]
n3 = l[2]
distances = []
distances.append(abs(n2 - n1))
distances.append(abs(n3 - n1))
distances.append(abs(n3 - n2))
distances.sort()
print(distances[0] + distances[1])


l = list(map(int, input().split()))
dif = [l[0] - l[1], l[0] - l[2], l[1] - l[2]]
for i in range(len(dif)):
	dif[i] = abs(dif[i])
dif.remove(max(dif))
summ = 0
for j in dif:
	summ = summ + j
print(summ)


import math
d = list(map(int, input().split()))
d.sort()
print(d[2] - d[0])


q = lambda : map(int, input().split())
qi = lambda : int(input())
qs = lambda : input().split()
a = list(q())
print(max(a) - min(a))


(x1, x2, x3) = sorted(list(map(int, input().split())))
print(x3 - x1)


string = input()
points = string.split(' ')
for x in range(3):
	temp = points[x]
	del points[x]
	points.insert(x, int(temp))
distance = []
for x in range(min(points), max(points) + 1):
	total = 0
	for y in points:
		string = str(x - y)
		string = string.replace('-', '')
		string = int(string)
		total += string
	distance.append(total)
print(min(distance))


(a, b, c) = map(int, input().split())
res = min(abs(a - b) + abs(a - c), abs(b - a) + abs(b - c), abs(c - a) + abs(c - b))
print(res)


abc = list(map(int, input().split()))[:3]
abc.sort()
print(abc[2] - abc[1] + (abc[1] - abc[0]))


l = [int(x) for x in input().split()]
l.sort()
tam = len(l)
print(l[tam - 1] - l[0])


a = list(map(int, input().split()))
l = list(a)
x = max(l)
y = min(l)
l.remove(x)
l.remove(y)
print(x - l[0] + l[0] - y)


(x1, x2, x3) = map(int, input().split())
d = max(abs(x1 - x2), abs(x1 - x3), abs(x2 - x3))
print(d)


(x1, x2, x3) = map(int, input().split())
x = [x1, x2, x3]
a = max(x) - min(x)
print(a)


l = list(map(int, input().split()))
l = sorted(l)
min = l[1]
sum = 0
sum = min - l[0]
sum = sum + (l[2] - min)
print(sum)


def main():
	ans = 99999
	x = list(map(int, input().split()))
	for i in x:
		ans = min(ans, sum([abs(i - j) for j in x]))
	print(ans)
main()


a = list(map(int, input().split()))
a.sort()
c = []
if a[1] - a[0] < a[2] - a[1]:
	for i in range(a[1], a[2] + 1):
		c.append(i - a[0] - a[1] + a[2])
else:
	for i in range(a[0], a[1] + 1):
		c.append(i - a[0] + a[1] + a[2] - i - i)
print(min(c))


k = input().split()
x = int(k[0])
y = int(k[1])
z = int(k[2])
if x <= y <= z:
	print(y - x + (z - y))
elif y <= x <= z:
	print(x - y + (z - x))
elif z <= y <= x:
	print(y - z + (x - y))
elif z <= x <= y:
	print(x - z + (y - x))
elif x <= z <= y:
	print(z - x + (y - z))
elif y <= z <= x:
	print(z - y + (x - z))


x = [int(s) for s in input().split()]
ans = 10 ** 9
for y in range(min(x), max(x) + 1):
	cnt = 0
	for xi in x:
		cnt += abs(xi - y)
	ans = min(ans, cnt)
print(ans)


L = list(map(int, input().split()))
x = abs(L[0] - L[1]) + abs(L[2] - L[1])
y = abs(L[1] - L[0]) + abs(L[2] - L[0])
z = abs(L[0] - L[2]) + abs(L[1] - L[2])
print(min(x, y, z))


array = list(map(int, input().split()))
array.sort()
print(array[2] - array[0])


(n, m, b) = map(int, input().split())
print(min(abs(n - m) + abs(m - b), abs(n - b) + abs(m - b), abs(n - m) + abs(n - b)))


input = [int(a) for a in input().split(' ')]
val = sorted(input)
x = val[1] - val[0]
y = val[2] - val[1]
print(x + y)


x = list(map(int, input().strip().split()))
x.sort()
d = 2 * x[2]
a = int((x[0] + x[1]) / 2)
b = int((x[2] + x[1]) / 2) + 1
c = x[2] - x[0]
for i in range(a, b):
	d = min(abs(i - x[1]) + c, d)
print(d)


(x, y, z) = map(int, input().split())
q = abs(x - y) + abs(x - z)
w = abs(y - z) + abs(y - x)
e = abs(z - x) + abs(z - y)
s = (x + y + z) / 3
d = int(abs(x - s) + abs(y - s) + abs(z - s))
print(min(q, w, e))


import statistics as sta
houses = list(map(int, input().split()))
(median, answer) = (sta.median(houses), 0)
for house in houses:
	answer += abs(house - median)
print(answer)


(x, y, z) = [int(i) for i in input().split()]
print(max(max(x, y), z) - min(min(x, y), z))


l = list(map(int, input().split()))
maxn = 0
for i in l:
	if i > maxn:
		maxn = i
l.remove(maxn)
if l[0] < maxn and l[0] < l[1]:
	print(maxn - l[1] + (l[1] - l[0]))
else:
	print(maxn - l[0] + (l[0] - l[1]))


points = list(map(int, input().split(' ')))
close = min(points)
further = max(points)
middle = 0
for item in points:
	if item != close and item != further:
		middle = item
		break
print(middle - close + (further - middle))


n = list(map(int, input().split()))
n.sort()
nmax = max(n)
nmin = min(n)
sum = nmax - n[1] + (n[1] - nmin)
print(sum)


x = [int(i) for i in input().split()]
x.sort()
z = x[1] - x[0]
x = x[2] - x[1]
print(z + x)


lst = list(map(int, input().split()))
print(max(lst) - min(lst))


import sys
settings = list(map(int, input().split()))
max_value = max(settings)
min_value = min(settings)
answer = max_value - min_value
print(answer)


(x1, x2, x3) = list(map(int, input().strip().split(' ')))
print(max(x1, x2, x3) - min(x1, x2, x3))


mas = [0] * 3
mas = list(map(int, input().split()))
mas.sort()
print(mas[2] - mas[0])


s = input()
n = [int(s) for s in s.split()]
n.sort()
print(n[1] - n[0] + (n[2] - n[1]))


(a, b, c) = map(int, input().split())
d1 = abs(b - a) + abs(c - a)
d2 = abs(a - b) + abs(c - b)
d3 = abs(a - c) + abs(b - c)
print(min(d1, d2, d3))


(a, b, c) = map(int, input().split())
f3 = max(a, b, c)
f1 = min(a, b, c)
f2 = a + b + c - f3 - f1
print(f2 - f1 + f3 - f2)


d = list(map(int, input().split(' ')))
print(max(d) - min(d))


x = input().split()
x = [int(i) for i in x]
x = sorted(x)
counter = 0
y = x[1] - x[0]
counter += y
z = x[2] - x[1]
counter += z
print(counter)


line = input()
strings = line.split()
list = []
for string in strings:
	list.append(eval(string))
result = sorted(list)
print(result[2] - result[0])


data = input()
lst = list()
for i in data.split():
	lst.append(int(i))
lst.sort()
distance = lst[2] - lst[0]
print(distance)


(x1, x2, x3) = list(map(int, input().split()))
d = max(x1, x2, x3) - min(x1, x2, x3)
print(d)


def trial():
	nums = sorted(list(map(int, input().split())))
	counter = max(nums) - nums[1] + (nums[1] - min(nums))
	return print(counter)
trial()


friends = [int(x) for x in input().split()]
friends.sort()
print(friends[1] - friends[0] + friends[2] - friends[1])


(x1, x2, x3) = map(int, input().split())
s = min(x1, x2, x3)
l = max(x1, x2, x3)
print(l - s)


def solve(arr):
	arr.sort()
	return abs(arr[1] - arr[0]) + abs(arr[1] - arr[2])
print(solve(list(map(int, input().split(' ')))))


x = [int(n) for n in input().split()]
x.sort()
m = x[1] - x[0]
m += x[2] - x[1]
print(m)


List = list(map(int, input().split()))
print(max(List) - min(List))


(x, y, z) = sorted(map(int, input().split()))
avg = (x + y + z) // 3
print(abs(avg - x) + abs(avg - z))


a = input()
b = a.split(' ')
c = []
for i in range(len(b)):
	b[i] = int(b[i])
for j in range(min(b), max(b) + 1):
	x = [abs(b[0] - j), abs(b[1] - j), abs(b[2] - j)]
	y = sum(x)
	c.append(y)
print(min(c))


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
A = [int(x) for x in input().split()]
ans = float('inf')
for i in range(max(A) + 1):
	t = sum([abs(v - i) for v in A])
	ans = min(ans, t)
print(ans)


y = list(map(int, input().split()))
y.sort()
a = y[0]
b = y[1]
c = y[2]
mn = 300
for i in range(a, c):
	x = abs(a - i) + abs(b - i) + abs(c - i)
	mn = min(x, mn)
print(mn)


friends = list((int(i) for i in input().split()))
friends.sort()
sum = friends[1] - friends[0] + friends[2] - friends[1]
print(sum)


a = [int(i) for i in input().split()]
(t1, t2) = (max(a), min(a))
s = 0
print(t1 - t2)


a = list(map(int, input().split()))
c = []
c.extend(a)
c.sort(reverse=True)
v = c[0] - c[1] + (c[1] - c[2])
print(v)


c = sorted(list(map(int, input().split())))
print(c[1] - c[0] + c[2] - c[1])


points = [int(val) for val in input().split()]
max_p = max(points)
min_p = min(points)
middle_p = list(filter(lambda x: x not in [max_p, min_p], points))[0]
print(max_p - middle_p + middle_p - min_p)


(x1, x2, x3) = [int(s) for s in input().split()]
print(min((abs(x1 - y) + abs(x2 - y) + abs(x3 - y) for y in range(1, 101))))


(x, y, z) = map(int, input().split())
l = []
p = abs(x - y)
l.append(p)
q = abs(y - z)
l.append(q)
r = abs(z - x)
l.append(r)
print(max(l))


l = [int(x) for x in input().split()]
l.sort()
mid = l[1]
ans = 0
for i in range(3):
	ans += abs(int(mid) - int(l[i]))
print(ans)


points = sorted(map(int, input().split()))
dist = points[-1] - points[0]
print(dist)


(a, b, c) = [int(x) for x in input().split()]
print(min(abs(a - b) + abs(a - c), abs(a - c) + abs(b - c), abs(a - b) + abs(c - b)))


ly1 = [eval(x) for x in input().split()]
ly2 = sorted(ly1)
print(ly2[2] - ly2[0])


(x, y, z) = map(int, input().split())
s = abs(x - y) + abs(x - z)
if s > abs(y - x) + abs(y - z):
	s = abs(y - x) + abs(y - z)
if s > abs(z - x) + abs(z - y):
	s = abs(z - x) + abs(z - y)
print(s)


l = list(map(int, input().split()))
y = sorted(l)
x = abs(y[1] - y[0])
z = abs(y[1] - y[2])
print(x + z)


a = input().split()
a = [int(i) for i in a]
x = max(a)
y = min(a)
for i in a:
	if i > y:
		z = i
		break
sum = x - z + z - y
print(sum)


a = input().split(' ')
a = [int(i) for i in a]
b = [0, 0, 0]
b[0] = min(a[0], a[1], a[2])
b[2] = max(a[0], a[1], a[2])
b[1] = a[0] + a[1] + a[2] - b[0] - b[2]
print(b[2] - b[0])


from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)

def read_int():
	return int(stdin.readline())

def read_ints():
	return [int(x) for x in stdin.readline().split()]

def read_str():
	return input()

def read_strs():
	return [x for x in stdin.readline().split()]
friends = read_ints()
print(max(friends) - min(friends))


n = input().split()
lst = list()
for i in range(3):
	lst.append(int(n[i]))
m = max(lst)
mi = min(lst)
for i in lst:
	if i == m or i == mi:
		continue
	else:
		s = abs(i - m) + abs(i - mi)
print(s)


a = sorted(list(map(int, input().split())))
cnt = 0
cnt = cnt + (a[1] - a[0])
cnt = cnt + (a[2] - a[1])
print(cnt)


loc = list(map(int, input().split()))
loc.sort()
print(loc[2] - loc[0])


(a, b, c) = map(int, input().split())
a = sorted([x for x in (a, b, c)])
print(a[1] - a[0] + a[2] - a[1])


import sys
nums = list(map(int, sys.stdin.readline().split()))
nums.sort()
avg = int(sum(nums) / 3)
if abs(nums[0] - avg) + abs(nums[1] - avg) + abs(nums[2] - avg) > abs(nums[1] - nums[0]) + abs(nums[2] - nums[1]):
	print(abs(nums[1] - nums[0]) + abs(nums[2] - nums[1]))
else:
	print(abs(nums[0] - avg) + abs(nums[1] - avg) + abs(nums[2] - avg))


points = sorted([int(i) for i in str(input()).split(' ')])
print(points[1] - points[0] + points[2] - points[1])


x = list(map(int, input().split()))
x.sort()
total = 0
total += x[2] - x[1]
total += x[1] - x[0]
print(total)


def solve(list1):
	maxx = max(list1)
	minn = min(list1)
	list1.remove(maxx)
	list1.remove(minn)
	result = maxx - list1[0] + (list1[0] - minn)
	return result
a = [int(j) for j in input().split(' ')]
list1 = []
for i in a:
	list1.append(i)
print(solve(list1))


(a, b, c) = map(int, input().split())
m1 = min(a, b, c)
m2 = max(a, b, c)
S = a + b + c - min(a, b, c) - max(a, b, c)
print(S - m1 + m2 - S)


(x1, x2, x3) = tuple(map(int, input().strip().split()))
(x1, x2, x3) = tuple(sorted([x1, x2, x3]))
print(abs(x1 - x2) + abs(x2 - x3))


(a, b, c) = input().split()
(a, b, c) = (int(a), int(b), int(c))
if a >= b and a >= c:
	largest = a
elif b >= a and b >= c:
	largest = b
else:
	largest = c
if a <= b and a <= c:
	smallest = a
elif b <= a and b <= c:
	smallest = b
else:
	smallest = c
print(largest - smallest)


a = list(map(int, input().split()))
m = max(a)
m1 = min(a)
l = abs(m - m1)
print(l)


(x1, x2, x3) = map(int, input().split())
y = [x1, x2, x3]
z = max(y)
y.remove(z)
m = max(y)
y.remove(m)
print(z - m + (m - y[0]))


standings = list(map(int, input().split()))
standings.sort(reverse=True)
point = (standings[0] + standings[2]) / 2
sum = 0
for i in range(3):
	sum += abs(standings[i] - point)
result = 0
for i in range(3):
	result += abs(standings[1] - standings[i])
if result < sum:
	print(int(result))
else:
	print(int(sum))


arr = [int(i) for i in input().split()]
minDis = sum(arr)
val = 0
ls = []
for i in range(len(arr)):
	for j in range(len(arr)):
		tmpDis = abs(arr[i] - arr[j])
		ls.append(tmpDis)
	val = sum(ls)
	ls.clear()
	if val < minDis:
		minDis = val
print(int(minDis))


a = input()
b = a.split(' ')
c = [int(b[0]), int(b[1]), int(b[2])]
d = sorted(c)
print(d[2] - d[0])


(a, b, c) = map(int, input().split())
if a > b:
	if a > c:
		if b > c:
			s = a - b + (b - c)
		else:
			s = a - c + (c - b)
	else:
		s = c - a + (a - b)
elif b > c:
	if a > c:
		s = b - a + (a - c)
	else:
		s = b - c + (c - a)
else:
	s = c - b + (b - a)
print(s)


def main():
	lst = [int(x) for x in input().split()]
	lst.sort()
	print(lst[2] - lst[0])
main()


from typing import List

def parse_input() -> List[int]:
	return [int(x) for x in input().split()]

def solve(a: int, b: int, c: int) -> int:
	(a, b, c) = sorted([a, b, c])
	return c - a
(a, b, c) = parse_input()
print(solve(a, b, c))


import math
s = list(map(int, input().split()))
s.sort()
print(abs(s[0] - s[1]) + abs(s[2] - s[1]))


def main():
	A = tuple(map(int, input().rstrip().split()))
	print(max(A) - min(A))
main()


isDebug = False
x = input().split(' ')
x = [int(i) for i in x]
x = sorted(x)
(x1, x2, x3) = x
print(f'{x2 - x1 + (x3 - x2)}')


(a, b, c) = map(int, input().split())
d = a + b + c
s = int(d / 3)
print(max(a, b, c) - s + (s - min(a, b, c)))


from math import floor as f, ceil as ce
x = list(map(int, input().split()))
x.sort()
(a, b, c) = x
d = x[1]
e = abs(a - d) + abs(b - d) + abs(c - d)
print(e)


(x1, x2, x3) = map(int, input().split())
s = sorted([x1, x2, x3])
print(abs(s[1] - s[0]) + abs(s[1] - s[2]))


f = lambda : map(int, input().split())
l = sorted(list(f()))
print(sum((abs(l[i] - l[1]) for i in range(3))))


position = [int(i) for i in input().split()]
print(max(position) - min(position))


n = map(int, input().split())
(x1, x2, x3) = n
print(max(x1, x2, x3) - min(x1, x2, x3))


data = sorted(map(int, input().split()))
print(data[2] - data[0])


coords = input().split(' ')
coords = [int(coord) for coord in coords]

def distance(a, b, c, x):
	return abs(a - x) + abs(b - x) + abs(c - x)
min_dist = float('inf')
for i in coords:
	d = distance(coords[0], coords[1], coords[2], i)
	if d < min_dist:
		min_dist = d
print(min_dist)


i = list(map(int, input().split()))
i.sort()
print(i[1] - i[0] + i[2] - i[1])


(a, b, c) = input().split()
a = int(a)
b = int(b)
c = int(c)
Max = max(a, b, c)
Min = min(a, b, c)
print(Max - Min)


n = [int(i) for i in input().split()]
print(max(n) - min(n))


s = list(map(int, input().split()))
s.sort()
count = 0
count += s[1] - s[0]
count += s[2] - s[1]
print(count)


x = list(map(int, input().split()))
x.sort()
ans = 999
for i in range(x[0], x[2] + 1):
	temp = abs(i - x[0]) + abs(i - x[1]) + abs(i - x[2])
	if temp < ans:
		ans = temp
print(ans)


a = input()
b = a.split(' ')

def min(A):
	x = int(b[0])
	if int(b[1]) < x:
		x = int(b[1])
	if int(b[2]) < x:
		x = int(b[2])
	return x

def max(A):
	x = int(b[0])
	if int(b[1]) > x:
		x = int(b[1])
	if int(b[2]) > x:
		x = int(b[2])
	return x
print(str(max(b) - min(b)))


my_list = list(map(int, input().split()))
print(max(my_list) - min(my_list))


X = list(map(int, input().split()))
print(min(abs(X[0] - X[1]) + abs(X[0] - X[2]), abs(X[1] - X[0]) + abs(X[1] - X[2]), abs(X[2] - X[0]) + abs(X[2] - X[1])))


nums = [int(i) for i in input().split()]
nums.sort()
mid = nums[1]
print(mid - nums[0] + (nums[2] - mid))


import math
n = [int(n) for n in input().split()]
max = n[0]
min = n[0]
mid = n[0]
for i in range(len(n)):
	if n[i] >= max:
		max = n[i]
for i in range(len(n)):
	if n[i] <= min:
		min = n[i]
for i in range(len(n)):
	if n[i] > min and n[i] < max:
		mid = n[i]
s = max - mid + (mid - min)
print(s)


(*L,) = map(int, input().split())
print(max(L) - min(L))


ak = list(map(int, input().split()))
ak.sort()
ds = ak[1]
ds = abs(ak[0] - ds) + abs(ak[2] - ds)
print(ds)


a = input().split()
x = int(a[0])
y = int(a[1])
z = int(a[2])
ans = 10000000
for i in range(max(x, y, z)):
	dist = abs(x - i) + abs(y - i) + abs(z - i)
	ans = min(ans, dist)
print(ans)


(x, y, z) = map(int, input().split())
s = 0
i = max(x, y, z)
j = min(x, y, z)
s = i - j
print(s)


x = sorted(map(int, input().split()))
print(x[2] - x[1] + (x[1] - x[0]))


l = [int(item) for item in input().split()]
l.sort()
print(l[2] - l[0])


arr = input()
arr = arr.split(' ')

def difference(a, b):
	a = int(a)
	b = int(b)
	if a > b:
		return a - b
	else:
		return b - a
at1 = difference(arr[1], arr[0]) + difference(arr[0], arr[2])
at2 = difference(arr[1], arr[2]) + difference(arr[0], arr[1])
at3 = difference(arr[1], arr[2]) + difference(arr[0], arr[2])
print(min(at1, at2, at3))


x = list(map(int, input().strip().split()))
x.sort()
tot = 0
tot += abs(x[2] - x[1])
tot += abs(x[1] - x[0])
print(tot)


ww = [int(ee) for ee in input().split()]
ww.sort()
print(ww[2] - ww[0])


liste = []
x = input().split(' ')
for i in range(3):
	liste.append(int(x[i]))
liste = sorted(liste)
res = 0
for j in range(3):
	res += abs(liste[j] - liste[1])
print(res)


data = [int(x) for x in input().split()]
dis = []
dis.append(abs(data[0] - data[1]) + abs(data[0] - data[2]))
dis.append(abs(data[1] - data[0]) + abs(data[1] - data[2]))
dis.append(abs(data[2] - data[0]) + abs(data[2] - data[1]))
print(int(min(dis)))


houses = list(map(int, input().split()))
minH = min(houses)
maxH = max(houses)
print(maxH - minH)


import sys
from math import sqrt, floor
inp = sys.stdin.readline
read = lambda : list(map(int, inp().split()))

def solve():
	(a, b, c) = sorted(read())
	print(abs(c - a))
solve()


A = [int(x) for x in input().split()]
print(max(A) - min(A))


li = list(map(int, input().split()))
li = sorted(li)
c_1 = li[1] - li[0]
c_2 = li[2] - li[1]
sum = c_1 + c_2
print(sum)


l = [int(num) for num in input().split()]
l.sort()
print(l[2] - l[0])


import math
(x1, x2, x3) = map(int, input().split())
ans = max(x1, x2, x3) - min(x1, x2, x3)
print(ans)


ls = list(map(int, input().split()))
ls.sort()
mid = ls[1]
print(mid - ls[0] + (ls[2] - mid))


l = list(map(int, input().split()))
l = sorted(l)
s = l[1]
s1 = l[2] - s
s2 = abs(l[0] - s)
c = s1 + s2
print(c)


def meeting_friends(a):
	return max(a) - min(a)
a = list(map(int, input().split()))
result = meeting_friends(a)
print(result)


def go(ls):
	ls.sort()
	return int(ls[0] + ls[2] - 2 * ls[0])
ls = list(map(int, input().split()))
print(go(ls))


l = list(map(int, input().split(' ')))
l.sort()
x1 = l[0]
x2 = l[1]
x3 = l[2]
total = x3
for i in range(x1, x3 + 1):
	m = abs(i - x1) + abs(i - x2) + abs(i - x3)
	if m <= total:
		total = m
print(total)


(a, b, c) = map(int, input().split())
d = 500
for i in range(1, 101):
	d = min(d, abs(a - i) + abs(b - i) + abs(c - i))
print(d)


inp = sorted(map(int, input().split()))
lst = []
for x in inp:
	lst.append(x)
print(lst[1] - lst[0] + lst[2] - lst[1])


n = map(int, input().split())
n = sorted(n)
x = n[2] - n[1]
y = n[1] - n[0]
print(x + y)


s = input().split()
d = [int(s[0]), int(s[1]), int(s[2])]
l = []
for i in range(3):
	l.append(abs(d[i] - d[0]) + abs(d[i] - d[1]) + abs(d[i] - d[2]))
print(min(l))


friends = [int(x) for x in input().split()]
friends = sorted(friends)
distance = 0
k = friends[1]
for i in range(len(friends)):
	if friends[i] <= k:
		distance += k - friends[i]
	elif friends[i] > k:
		distance += friends[i] - k
print(distance)


s = sorted(map(int, input().split()))
print(s[2] - s[0])


(x1, x2, x3) = input().strip().split(' ')
(x1, x2, x3) = (int(x1), int(x2), int(x3))
ans = 300
(mi, Mi) = (min(x1, x2, x3), max(x1, x2, x3))
for i in range(mi, Mi + 1):
	if abs(i - x1) + abs(i - x2) + abs(i - x3) < ans:
		ans = abs(i - x1) + abs(i - x2) + abs(i - x3)
print(ans)


ox = list(map(int, input().split()))
print(max(ox) - min(ox))


(a, b, c) = map(int, input().split())
if a < b < c or c < b < a:
	print(abs(a - b) + abs(c - b))
if b < a < c or c < a < b:
	print(abs(a - b) + abs(a - c))
if a < c < b or b < c < a:
	print(abs(c - b) + abs(c - a))


li = [int(x) for x in input().strip().split(' ')]
li.sort()
dist = li[1] - li[0] + li[2] - li[1]
print(dist)


import sys
(a, b, c) = map(int, sys.stdin.readline().split())
q = sorted([a, b, c])
sys.stdout.write(str(q[2] - q[0]))


import sys
inf = float('inf')
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
(mod, MOD) = (1000000007, 998244353)
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
(a, b, c) = get_ints()
print(min(abs(a - b) + abs(a - c), abs(a - b) + abs(b - c), abs(a - c) + abs(b - c)))


n = list(map(int, input().split()))
m = max(n)
n.remove(m)
mm = max(n)
mn = mm - min(n)
print(m + mn - mm)


(x, _, y) = sorted(map(int, input().split()))
print(y - x)


x = list(map(int, input().split(' ')))
x.sort()
a = 0
for i in range(len(x)):
	a += abs(x[len(x) // 2] - x[i])
print(a)


x = list(map(int, input().strip().split()))
print(abs(min(x) - max(x)))


a = list(map(int, input().split()))
a.sort()
print(a[-1] - a[0])


(a, b, c) = map(int, input().split())
print(min((abs(a - x) + abs(b - x) + abs(c - x) for x in range(200))))


(a, b, c) = map(int, input().split())
l = []
first = abs(a - c)
second = abs(a - b)
third = abs(b - c)
l.append(first + second)
l.append(second + third)
l.append(first + third)
print(min(l))


s = map(int, input().split())
s = sorted(s)
print(sum([abs(s[0] - int(sum(s) / 3)) + abs(s[2] - int(sum(s) / 3))]))


(x, y, z) = map(int, input().split())
if x > y and x > z:
	a = x
	if y > z:
		b = y
		c = z
	else:
		b = z
		c = y
elif y > x and y > z:
	a = y
	if x > z:
		b = x
		c = z
	else:
		b = z
		c = x
else:
	a = z
	if x > y:
		b = x
		c = y
	else:
		b = y
		c = x
n = a + c
k = n / 2
print(int(a - k + (k - c)))


(x1, x2, x3) = input().split()
(x1, x2, x3) = (int(x1), int(x2), int(x3))
lst = []
lst.append(abs(x1 - x2) + abs(x3 - x2))
lst.append(abs(x2 - x1) + abs(x3 - x1))
lst.append(abs(x2 - x3) + abs(x1 - x3))
print(min(lst))


from math import *
a = [int(x) for x in input().split()]
a = sorted(a)
print(a[2] - a[1] + a[1] - a[0])


b = input().split()
b = list(map(int, b))
b.sort()
minD = b[2] - b[1] + (b[1] - b[0])
print(minD)


arr = [int(i) for i in input().split(' ')]
arr.sort()
res1 = arr[1] - arr[0] + arr[2] - arr[0]
res2 = arr[1] - arr[0] + arr[2] - arr[1]
res3 = arr[2] - arr[0] + arr[2] - arr[1]
print(min(res1, res2, res3))


(a, b, c) = map(int, input().split())
lst = []
lst.append(a)
lst.append(b)
lst.append(c)
lst.sort()
print(lst[2] - lst[1] + lst[1] - lst[0])


i = input().split()
i.sort(key=int)
p = int(i[1]) - int(i[0])
q = int(i[2]) - int(i[1])
print(p + q)


(a, b, c) = map(int, input().split())
z = [a, b, c]
z = sorted(z)
p = z[1] - z[0]
q = z[2] - z[1]
print(p + q)


(a, b, c) = map(int, input().split())
start = min(a, b, c)
end = max(a, b, c)
Min = abs(start - a) + abs(start - b) + abs(start - c)
ans = start
for i in range(start + 1, end + 1):
	temp = abs(i - a) + abs(i - b) + abs(i - c)
	if temp < Min:
		Min = temp
		ans = i
print(Min)


import math
args = input().split(' ')
a = int(args[0])
b = int(args[1])
c = int(args[2])
min_dist = 100000
min_point = 0
for i in range(1, 101):
	dist = math.fabs(a - i) + math.fabs(b - i) + math.fabs(c - i)
	if dist < min_dist:
		min_dist = int(dist)
		min_point = i
print(min_dist)


(x1, x2, x3) = map(int, input().split())
b = []
b.append(x1)
b.append(x2)
b.append(x3)
b.sort()
diff = b[1] - b[0]
diff1 = b[2] - b[1]
res = diff + diff1
print(res)


c = list(map(int, input().split()))
print(max(c) - min(c))


(x1, x2, x3) = input().split()
x1 = int(x1)
x2 = int(x2)
x3 = int(x3)
_max = max(x1, x2, x3)
_min = min(x1, x2, x3)
print(_max - _min)


s = input()
a = s.split()
for i in range(len(a)):
	a[i] = int(a[i])
print(max(a) - min(a))


ls = list(map(int, input().split()))
ls.sort()
print(ls[2] - ls[0])


def srered(a, b, c):
	mini = min(a, b, c)
	maxi = max(a, b, c)
	if a != mini and a != maxi:
		sr = a
	if b != mini and b != maxi:
		sr = b
	if c != mini and c != maxi:
		sr = c
	return sr
(a, b, c) = map(int, input().split())
value = 0
mini = min(a, b, c)
maxi = max(a, b, c)
sr = srered(a, b, c)
while mini != int(sr):
	value += 1
	mini += 1
while maxi != int(sr):
	value += 1
	maxi -= 1
print(value)


arr = list(map(int, input().split()))
avg = sum(arr) // 3
sum1 = 0
ls = []
for i in range(len(arr)):
	diff = abs(arr[i] - avg)
	ls.append(diff)
ans = arr[ls.index(min(ls))]
for i in range(len(arr)):
	sum1 += abs(arr[i] - ans)
print(sum1)


l = input().split(' ')
l[0] = int(l[0])
l[1] = int(l[1])
l[2] = int(l[2])
for i in range(3):
	for j in range(3):
		if l[i] > l[j]:
			(l[i], l[j]) = (l[j], l[i])
c = int(l[0]) - int(l[1])
c = c + int(l[1]) - int(l[2])
print(c)


a = list(map(int, input().split()))
a.sort()
x1 = a[0]
x3 = a[2]
print(x3 - x1)


n = list(map(int, input().split()))
sm = 0
n.sort()
mid = n[len(n) // 2]
for i in n:
	sm += abs(i - mid)
print(sm)


l = [int(i) for i in input().split()]
a = l[0]
b = l[1]
c = l[2]
for i in l:
	if i != max(a, b, c) and i != min(a, b, c):
		d = i
print(abs(max(a, b, c) - d) + abs(d - min(a, b, c)))


l = list(input().split())
li = []
for i in l:
	li.append(int(i))
li.sort()
m = li[1]
t = m - li[0] + (li[2] - m)
print(t)


x = [int(a) for a in input().split()]
mi = min(x)
ma = max(x)
x.remove(mi)
x.remove(ma)
me = x[0]
print(abs(mi - me) + abs(ma - me))


lis = list(map(int, input().split()))
print(max(lis) - min(lis))


l = list(map(int, input().split()))
l.sort()
m = l[len(l) // 2]
s = 0
for i in l:
	s = s + abs(i - m)
print(s)


x1 = list(map(int, input().split()))
x2 = sorted(x1)
count = x2[1] - x2[0]
count = count + (x2[2] - x2[1])
print(count)


(f1, f2, f3) = map(int, input().split())
l = []
l.append(f1)
l.append(f2)
l.append(f3)
d1 = min(f1, f2, f3)
d2 = max(f1, f2, f3)
l.remove(d1)
l.remove(d2)
result = abs(f1 - l[0]) + abs(f2 - l[0]) + abs(f3 - l[0])
print(result)


from sys import stdin, stdout

def solve(coordinates):
	return max(coordinates) - min(coordinates)
coordinates = list(map(int, stdin.readline().split()))
stdout.write(str(solve(coordinates)))


cords = list(map(int, input().split()))
cords.sort()
print(cords[1] - cords[0] + (cords[2] - cords[1]))


numbers = list(map(lambda x: int(x), input().split()))
numbers.sort()
distance = numbers[1] - numbers[0] + numbers[2] - numbers[1]
print(distance)


nums = [int(num) for num in input().split()]
print(max(nums) - min(nums))


import random
str = input()
s = list(map(int, str.split(' ')))

def quickSort(a):
	if len(a) <= 1:
		return a
	else:
		pivot = random.choice(a)
		less = [x for x in a if x < pivot]
		greater = [x for x in a if x > pivot]
		equal = [x for x in a if x == pivot]
		return quickSort(less) + equal + quickSort(greater)
s = quickSort(s)
print(abs(s[2] - s[0]))


(a, b, c) = input().split()
a = int(a, 10)
b = int(b, 10)
c = int(c, 10)
k1 = max(a, b, c)
k2 = min(a, b, c)
l = abs(a - k2) + abs(b - k2) + abs(c - k2)
for i in range(k2, k1 + 1, 1):
	d = abs(a - i) + abs(b - i) + abs(c - i)
	if d < l:
		l = d
print(l)


X = list(map(int, input().split()))
print(max(X) - min(X))


import math
a = [int(i) for i in input().split()]
d = sorted(a)
print(d[2] - d[0])


a = [int(g) for g in input().split()]
print(max(a) - min(a))


(a, b, c) = map(int, input().split())
x = 1

def getDistance(x, a, b, c):
	return abs(x - a) + abs(x - b) + abs(x - c)
min1 = getDistance(x, a, b, c)
for i in range(2, 101):
	if getDistance(i, a, b, c) < min1:
		min1 = getDistance(i, a, b, c)
print(min1)


l = list(map(int, input().split(' ')))
l = sorted(l)
a = l[1]
l.remove(l[1])
sum = 0
for i in l:
	sum += abs(i - a)
print(sum)


(x1, x2, x3) = [int(i) for i in input().split()]
print(max(x1, x2, x3) - min(x1, x2, x3))


dist = [int(x) for x in input().split()]
print(max(dist) - min(dist))


(a, b, c) = [int(i) for i in input().split()]
x = max(max(a, b), c)
y = min(min(a, b), c)
z = x - y
print(z)


nums = list((int(j) for j in input().split()))
nums = sorted(nums)
print(nums[2] - nums[0])


l = list(map(int, input().split()))
l.sort()
dist = l[1] - l[0] + (l[2] - l[1])
print(dist)


(a, b, c) = list(map(int, input().split()))
_max = max(a, max(b, c))
_min = min(a, min(b, c))
print(_max - _min)


ary = sorted([int(i) for i in input().split()])
s = 0
for i in ary:
	s += abs(i - ary[1])
print(s)


arr = list(map(int, input().split()))
arr.sort()
l = len(arr) - 1
min_d = 10 ** 9 + 7
pt = 0
for i in range(arr[0], arr[l] + 1):
	dis = 0
	for j in arr:
		dis += abs(i - j)
	if dis < min_d:
		min_d = dis
		pt = i
print(min_d)


(a, b, c) = sorted(map(int, input().split()))
ac = c - a + c - b
ab = c - b + b - a
aa = c - a + b - a
print(min([aa, ab, ac]))


(x, y, z) = map(int, input().split())
c = max(x, y, z)
d = min(x, y, z)
e = x + y + z - (c + d)
print(c - e + (e - d))


a = [int(i) for i in input().split()]
for i in range(3):
	if a[i] != max(a) and a[i] != min(a):
		s = a[i]
d = 0
while a[0] != s or a[1] != s or a[2] != s:
	if a[0] < s:
		a[0] += 1
		d += 1
	elif a[0] > s:
		a[0] -= 1
		d += 1
	if a[1] < s:
		a[1] += 1
		d += 1
	elif a[1] > s:
		a[1] -= 1
		d += 1
	if a[2] < s:
		a[2] += 1
		d += 1
	elif a[2] > s:
		a[2] -= 1
		d += 1
print(d)


(a, b, c) = map(int, input().split())
min_x = 1000000000.0
for i in range(1, 101):
	min_x = min((i - a).__abs__() + (i - b).__abs__() + (i - c).__abs__(), min_x)
print(min_x)


l1 = list(map(int, input().split()))
l1.sort()
print(l1[2] - l1[0])


(x1, x2, x3) = map(int, input().split())
x = [x1, x2, x3]
y = []
y.append(abs(x[1] - x[0]) + abs(x[2] - x[0]))
y.append(abs(x[0] - x[1]) + abs(x[2] - x[1]))
y.append(abs(x[0] - x[2]) + abs(x[1] - x[2]))
print(min(y))


ip = input()
p = ip.split(' ')
for i in range(3):
	p[i] = int(p[i])
Min = 99999
for i in range(max(p)):
	now = abs(p[0] - i) + abs(p[1] - i) + abs(p[2] - i)
	Min = min(Min, now)
print(Min)


l = [int(x) for x in input().split()]
l.sort()
s = l[2] - l[0]
print(s)


import sys
input = sys.stdin.readline

def main():
	lst = list(map(int, input().split()))
	print(max(lst) - min(lst))
main()


pqr = input().split()
p = int(pqr[0])
q = int(pqr[1])
r = int(pqr[2])
s = max(p, q, r)
t = min(p, q, r)
u = p + q + r - s - t
total = s - u + (u - t)
print(total)


m = list(map(int, input().split()))
m.sort()
print(m[1] - m[0] + (m[2] - m[1]))


li = [int(i) for i in input().split()]
s = max(li)
li.remove(s)
m = max(li)
li.remove(m)
k = 0
k += s - m
k += m - li[0]
print(k)


(x1, x2, x3) = map(int, input().split())
m = max(x1, x2, x3)
n = min(x1, x2, x3)
d = x1 + x2 + x3
for i in range(n, m + 1):
	d = min(d, abs(x1 - i) + abs(x2 - i) + abs(x3 - i))
print(d)


(x, y, z) = map(int, input().split())
l = []
l.append(abs(z - x))
l.append(abs(z - y))
l.append(abs(x - y))
print(max(l))


coords = [int(string) for string in input().split()]
print(int(max(coords) - min(coords)))


l = list(map(int, input().split()))
s = set(l)
if len(s) == 1:
	print(0)
elif len(s) == 2:
	sum1 = 0
	list(s)
	diff = abs(l[0] - l[1])
	print(diff)
else:
	l.sort()
	a = abs(l[0] - l[1])
	b = abs(l[2] - l[1])
	print(a + b)


(a, b, c) = map(int, input().split())
if a > b and a < c:
	ele = a
elif b > a and b < c:
	ele = b
else:
	ele = c
print(abs(ele - max(a, b, c)) + abs(ele - min(a, b, c)))


k = input().split()
l = sorted((int(x) for x in k))
z = int(l[-1]) - int(l[1]) + (int(l[1]) - int(l[0]))
print(z)


text = input().split()
li = [int(i) for i in text]
li.sort()
mid = li[1]
print(li[2] - mid + (mid - li[0]))


import math
(a, b, c) = map(int, input().split())
print(min(abs(a - b) + abs(a - c), abs(b - a) + abs(b - c), abs(c - a) + abs(c - b)))


k = []
s = input().split(' ')
for i in s:
	k.append(int(i))
k.sort()
print(k[2] - k[0])


tmp = list(map(int, input().split()))
print(max(tmp) - min(tmp))


(x, y, z) = map(int, input().split())
first = min(x, y, z)
last = max(x, y, z)
middle = x + y + z - first - last
print(last - middle + middle - first)


a_b_c = input()
abc = a_b_c.split()
abc = list(map(int, abc))
abc = sorted(abc)
(a, b, c) = abc
ans = c - a
print(ans)


ar = list(map(int, input().strip().split()))
ar.sort()
print(ar[1] - ar[0] + ar[2] - ar[1])


n = list(map(int, input().strip().split()))[:3]
n.sort()
print(n[2] - n[0])


import math
li = [int(i) for i in input().split(' ')]
li.sort()
print(li[2] - li[0])


x = [int(i) for i in input().split(' ')]
min_dist = float('inf')
for j in range(101):
	if sum([abs(y - j) for y in x]) < min_dist:
		min_dist = sum([abs(y - j) for y in x])
print(min_dist)


line = list(map(int, input().split()))
line.sort()
print(line[2] - line[1] + line[1] - line[0])


a = [int(x) for x in input().split()]
a.sort()
x = a[0]
y = a[1]
z = a[2]
i = y - x
j = z - y
print(i + j)


x = [int(_) for _ in input().split()]
mn = 1000000000.0
ans = -1
for i in range(min(x), max(x) + 1):
	y = sum((abs(i - j) for j in x))
	if mn > y:
		mn = y
		ans = i
print(mn)


b = list(map(int, input().split()))
a = min(b)
c = max(b)
b.remove(a)
b.remove(c)
b = int(b[0])
print(b - a + c - b)


x = input().split()
h = []
for i in x:
	h.append(int(i))
	h = sorted(h)
print(h[2] - h[0])


from math import inf
(a, b, c) = list(map(int, input().split()))
print(max(a, b, c) - min(a, b, c))


(a, b, c) = map(int, input().split())
Max = max(a, b, c)
Min = min(a, b, c)
ans = Max - (a + b + c - (Max + Min)) + (a + b + c - (Max + Min)) - Min
print(ans)


a = [i for i in map(int, input().split())]
print(max(a) - min(a))


def main():
	a = list(map(int, input().split()))
	a.sort()
	ans = abs(a[-1] - a[1]) + abs(a[1] - a[0])
	print(ans)
	pass
main()


coordinate = [int(i) for i in input().split()]
print(max(coordinate) - min(coordinate))


F = list(map(int, input().split()))
F.sort()
print(F[-1] - F[1] + F[1] - F[0])


A = [int(j) for j in input().split()]
A.sort()
ans = A[2] - A[0]
print(ans)


s = input()
s = s.split()
for i in range(3):
	s[i] = int(s[i])
s = sorted(s)
print(s[2] - s[0])


n = list(map(int, input().split()))
n.sort()
count = n[1] - n[0] + (n[2] - n[1])
print(count)


pos = [int(x) for x in input().split()]
minn = 300
for x in range(1, 100 + 1):
	tmp = abs(pos[0] - x) + abs(pos[1] - x) + abs(pos[2] - x)
	if tmp < minn:
		minn = tmp
print(minn)


(a, b, c) = map(int, input().split())
lst = []
lst.insert(1, a)
lst.insert(2, b)
lst.insert(3, c)
lst.sort()
print(lst[1] - lst[0] + (lst[2] - lst[1]))


from statistics import *
x = list(map(int, input().split()))
print(max(x) - median(x) + (median(x) - min(x)))


arr = sorted([int(x) for x in input().split()])
print(abs(arr[0] - arr[2]))


nums = list(map(int, input().split()))
nums = sorted(nums)
print(abs(nums[0] - nums[1]) + abs(nums[1] - nums[2]))


(f1, f2, f3) = map(int, input().split())
m = max(f1, f2, f3)
n = min(f1, f2, f3)
if f2 < m and f2 > n:
	f2 = f2
elif f1 > n and f1 < m:
	f2 = f1
else:
	f2 = f3
s = m - f2 + (f2 - n)
print(s)


input_s = input().split(' ')
a = int(input_s[0])
b = int(input_s[1])
c = int(input_s[2])
d = max(a, b, c) - min(a, b, c)
print(d)


x = [int(i) for i in input().split()]
for i in range(len(x) - 1):
	for j in range(i, len(x)):
		if x[i] >= x[j]:
			(x[i], x[j]) = (x[j], x[i])
print(x[2] - x[1] + (x[1] - x[0]))


l = list(map(int, input().split()))
min_ = min(l)
max_ = max(l)
print(f'{max_ - min_}')


(a, b, c) = map(int, input().split())
mi = min(a, b, c)
ma = max(a, b, c)
num = float('inf')
for i in range(mi, ma + 1):
	tmp = 0
	tmp += abs(a - i)
	tmp += abs(b - i)
	tmp += abs(c - i)
	num = min(tmp, num)
print(num)


import sys
friends = sorted([int(a) for a in sys.stdin.readline().split()])
print(friends[2] - friends[0])


a = [int(x) for x in input().split()]
a.sort()
b = 3 * a[2]
c = 0
for i in range(a[0], a[2] + 1):
	if abs(i - a[0]) + abs(i - a[1]) + abs(i - a[2]) < b:
		b = abs(i - a[0]) + abs(i - a[1]) + abs(i - a[2])
print(b)


(a, b, c) = [int(x) for x in input().split()]
xiao = min(a, b, c)
da = max(a, b, c)
l = []
for i in range(xiao, da + 1):
	l.append(abs(a - i) + abs(b - i) + abs(c - i))
print(min(l))


ls = list(map(int, input().split()))
print(max(ls) - min(ls))


(a, b, c) = map(int, input().split())
m = min(a, b, c)
m1 = max(a, b, c)
print(m1 - m)


a = [int(x) for x in input().split()]
c = []
for b in range(1, 101):
	c.append(int(abs(a[0] - b) + abs(a[1] - b) + abs(a[2] - b)))
print(min(c))


n = list(map(int, input().split()))
n.sort()
a = n[2]
b = n[0]
print(a - b)


(a, b, c) = map(int, input().split())
t = 300
for i in range(1, max(a, b, c) + 1):
	if t > abs(i - a) + abs(i - b) + abs(i - c):
		t = abs(i - a) + abs(i - b) + abs(i - c)
print(t)


(a, b, c) = map(int, input().split())
jb = 0
mid = a + b + c - max(a, b, c) - min(a, b, c)
for r in (a, b, c):
	if mid - r < 0:
		jb += -(mid - r)
	else:
		jb += mid - r
print(jb)


x = list(map(int, input().split()))
dmin = int(1000000000.0 + 7)
for i in range(1, 101):
	d = abs(x[0] - i) + abs(x[1] - i) + abs(x[2] - i)
	dmin = min(dmin, d)
print(dmin)


import sys

def getli():
	return list(map(int, sys.stdin.readline().strip().split()))
A = getli()
print(max(A) - min(A))


def main():
	s = list(map(int, input().split()))
	s.sort()
	print(s[2] - s[0])
main()


(a, b, c) = map(int, input().split())
A = min(a, b, c)
C = max(a, b, c)
print(C - A)


pos = []
n = input()
pos = n.split()
for i in range(3):
	pos[i] = int(pos[i])
pos.sort(reverse=True)
k = pos[0] - pos[2]
print(k)


array = [int(item) for item in input().split()]
minV = min(array)
maxV = max(array)
for item in array:
	if item != minV or item != maxV:
		middle = item
print(middle - minV + (maxV - middle))


(x, y, z) = sorted([int(i) for i in input().split()])
print(abs(y - z) + abs(y - x))


arr = list(map(int, input().split()))
arr.sort()
diff = 0
for i in range(len(arr)):
	diff = arr[1] - arr[0] + (arr[2] - arr[1])
print(diff)


distances = input()
distances = distances.split()
temp = []
for i in distances:
	i = int(i)
	temp.append(i)
temp.sort()
minimum = temp[2] - temp[0]
print(minimum)


def main():
	l = [int(y) for y in input().split()]
	l.sort()
	ans = l[1] - l[0] + l[2] - l[1]
	print(ans)
main()


d = input().split()
d = [int(c) for c in d]
(x1, x2, x3) = (d[0], d[1], d[2])
print(min(abs(x2 - x1) + abs(x3 - x1), abs(x2 - x1) + abs(x3 - x2), abs(x2 - x3) + abs(x3 - x1)))


x = list(map(int, input().split()))
x.sort()
a = len(x)
b = a // 2
c = []
if a % 2 == 0:
	c = [min(x[b - 1], x[b])] * a
else:
	c = [x[b]] * a
ans = list(map(lambda i, j: abs(i - j), x, c))
print(sum(ans))


args = [int(x) for x in input().split(' ')]
args.sort()
print(str(args[2] - args[0]))


def main():
	l1 = list(map(int, input().split()))
	l1.sort()
	sum1 = l1[1] - l1[0] + (l1[2] - l1[1])
	print(sum1)
main()


l = list(map(int, input().split()))
l.sort()
(x1, x2, x3) = (l[0], l[1], l[2])
a = x3 - x2
b = x2 - x1
print(a + b)


num = list(map(int, input().split(' ')))
a = num[:]
maximum = max(num)
num.remove(maximum)
maximum1 = max(num)
count = 0
for i in range(len(a)):
	if a[i] > maximum1:
		subtract = a[i] - maximum1
		count = count + subtract
	elif a[i] < maximum1:
		sub = maximum1 - a[i]
		count = count + sub
	elif a[i] == maximum1:
		count = count + 0
print(count)


l = list(map(int, input().split()))
l = sorted(l)
print(str(l[2] - l[1] + (l[1] - l[0])), end='')


lst = [int(i) for i in input().split()]
lst.sort()
ans = lst[2] - lst[0]
print(ans)


(x1, x2, x3) = map(int, input().split())
p = []
p.append(x3)
p.append(x2)
p.append(x1)
p.sort()
print(p[1] - p[0] + p[2] - p[1])


ls = [int(a) for a in input().split()]
ls.sort()
print(ls[2] - ls[0])


n = [int(x) for x in input().split()]
n.sort(reverse=False)
print(n[2] - n[0])


import sys, math
f = list(map(int, input().split()))
f.sort()
print(f[1] - f[0] + f[2] - f[1])


lst = [int(x) for x in input().split()]
lst.sort()
ans = 0
for i in range(0, 3):
	ans += abs(int(lst[i] - lst[1]))
print(int(ans))


arr = list(map(int, input().split()))
arr.sort()
x = arr[1] - arr[0] + (arr[2] - arr[1])
print(x)


a = [int(x) for x in input().split()]
b = abs(a[0] - a[1]) + abs(a[0] - a[2])
c = abs(a[1] - a[0]) + abs(a[1] - a[2])
f = abs(a[2] - a[1]) + abs(a[2] - a[0])
l = [b, c, f]
print(min(l))


points = [int(val) for val in input().split()]
(min_p, middle_p, max_p) = sorted(points)
print(max_p - middle_p + middle_p - min_p)


(a, b, c) = map(int, input().split())
d = [a, b, c]
a = max(d)
b = min(d)
d.remove(a)
d.remove(b)
c = d.pop()
q = abs(c - a)
w = abs(c - b)
e = q + w
print(e)


(a, b, s) = map(int, input().split())
S = max(a, b, s) - min(a, b, s)
print(S)


L = input().split()
L = [int(i) for i in L]
L.sort()
print(L[2] - L[1] + L[1] - L[0])


position = [int(i) for i in input().split()]
position.sort()
print(position[2] - position[1] + (position[1] - position[0]))


x = list(map(int, input().split()))
x.sort()
valores = int(x[1]) - int(x[0]) + (int(x[2]) - int(x[1]))
print(valores)


(x1, x2, x3) = map(int, input().split())
y1 = min(x1, x2, x3)
y2 = max(x1, x2, x3)
if y1 == y2:
	print(y1)
else:
	line = []
	for i in range(y1, y2 + 1):
		s = abs(i - x1) + abs(i - x2) + abs(i - x3)
		line.append(s)
	print(min(line))


nums = [int(x) for x in input().split()]
nums.sort()
res = 0
for num in nums:
	res += abs(num - nums[1])
print(res)


locs = [int(x) for x in input().split(' ')]
mini = 99999
for i in range(min(locs), max(locs) + 1):
	s = 0
	for l in locs:
		s += abs(l - i)
	if s < mini:
		mini = s
print(mini)


a = [int(x) for x in input().split()]
a.sort()
n = a[2] - a[0]
print(n)


dist = input().split()
for i in range(0, 3):
	dist[i] = int(dist[i])
dist = sorted(dist)
minD = 300
for i in range(0, 3):
	x = abs(dist[0] - dist[i])
	y = abs(dist[1] - dist[i])
	z = abs(dist[2] - dist[i])
	if x + y + z < minD:
		minD = x + y + z
print(minD)


(a, b, c) = map(int, input().split())
d = []
d.append(a)
d.append(b)
d.append(c)
e = sorted(d)
print(abs(e[0] - e[1] + (e[1] - e[2])))


(x1, x2, x3) = input().split()
ma = max(int(x1), int(x2), int(x3))
mi = min(int(x1), int(x2), int(x3))
if mi < int(x1) < ma:
	td = abs(int(x1) - int(x2)) + abs(int(x1) - int(x3))
	print(td)
if mi < int(x2) < ma:
	td = abs(int(x2) - int(x1)) + abs(int(x2) - int(x3))
	print(td)
if mi < int(x3) < ma:
	td = abs(int(x3) - int(x1)) + abs(int(x3) - int(x2))
	print(td)


(x, y, z) = map(int, input().split())
points = sorted([x, y, z])
m = points[len(points) // 2]
print(sum((abs(p - m) for p in points)))


a = list(map(int, input().split()))
sum = 0
value = 0
len = len(a)
a.sort()
value = a[1] - a[0] + (a[2] - a[1])
print(value)


import math, sys, re, itertools
(rs, ri, rai) = (input, lambda : int(input()), lambda : list(map(int, input().split())))
a = rai()
a.sort()
print(a[1] - a[0] + a[2] - a[1])


line = sorted([int(x) for x in input().split(' ')])
print(str(line[2] - line[0]))


xs = sorted(list(map(int, input().split())))
dist = 0
dist += xs[1] - xs[0] + xs[2] - xs[1]
print(dist)


a = list(map(int, input().split()))
b = sorted(a)[1]
c = 0
for r in a:
	c = c + abs(b - r)
print(c)


x = list(map(int, input().strip().split(' ')))
x.sort()
mins = 101
for i in range(x[0], x[2] + 1):
	s = abs(i - x[0]) + abs(i - x[1]) + abs(i - x[2])
	mins = min(mins, s)
print(mins)


(a, b, c) = list(map(int, input().split()))
x = (abs(a - b) + abs(a - c) + abs(b - c)) // 2
print(x)


import os
import sys
import math
(x1, x2, x3) = input().strip().split(' ')
(x1, x2, x3) = [int(x1), int(x2), int(x3)]
x0 = 0
dist = abs(x1 - x0) + abs(x2 - x0) + abs(x3 - x0)
while x0 <= max(x1, x2, x3):
	dist = min(dist, abs(x1 - x0) + abs(x2 - x0) + abs(x3 - x0))
	x0 += 1
print(dist)


import sys
numbers = [int(i) for i in sys.stdin.readline().split()]
numbers.sort()
print(numbers[2] - numbers[0])


(a, b, c) = map(int, input().split())
ans1 = abs(b - c) + abs(b - a)
ans2 = abs(a - c) + abs(a - b)
ans3 = abs(c - a) + abs(c - b)
print(min(ans1, ans2, ans3))


li = map(int, input().split(' '))
li = sorted(li)
print(abs(li[0] - li[1]) + abs(li[2] - li[1]))


a = list(map(int, input().split()))
b = [[abs(x - i) for x in a] for i in range(1, 100)]
print(min([sum(x) for x in b]))


lst = [int(x) for x in input().split()]
print(max(lst) - min(lst))


__author__ = 'artyom'

def main():
	(a, _, b) = sorted(read(3))
	return b - a

def read(mode=2, size=None):
	if mode == 0:
		return input().strip()
	if mode == 1:
		return input().strip().split()
	if mode == 2:
		return int(input().strip())
	if mode == 3:
		return list(map(int, input().strip().split()))
	a = []
	for _ in range(size):
		a.append(read(3))
	return a

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, tuple) or isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='\n')
res = main()
write(res)


def selectio_sor(n):
	for i in range(len(n) - 1):
		min = i
		for j in range(i + 1, len(n)):
			if n[min] > n[j]:
				min = j
		tem = n[i]
		n[i] = n[min]
		n[min] = tem
ls = list(map(int, input().split()))
selectio_sor(ls)
print(ls[2] - ls[0])


import math
import sys
import heapq
from collections import deque, defaultdict
from itertools import permutations, combinations, combinations_with_replacement
import random
import os
mod = 10 ** 9 + 7
MAX = sys.maxsize
MIN = -sys.maxsize - 1

def isPrime(n):
	if n > 1:
		for i in range(2, n):
			if n % i == 0:
				return False
		else:
			return True
	else:
		return False

def isPanagram(s):
	alphabet = 'abcdefghijklmnopqrstuvwxyz'
	for char in alphabet:
		if char not in s.lower():
			return False
	return True

def isEqual(list1):
	if len(list1) < 0:
		res = True
	res = all((ele == list1[0] for ele in list1))
	if res:
		return True
	else:
		return False

def remove_duplicate(list1):
	final_list = []
	for i in list1:
		if i not in final_list:
			final_lis.append(i)
	return final_list

def solve():
	(x1, x2, x3) = map(int, input().split())
	a = min(x1, x2, x3)
	b = max(x1, x2, x3)
	return b - a
print(solve())


x = [int(t) for t in input().split()]
print(min([sum([abs(v - a) for v in x]) for a in range(111)]))


(a, b, c) = (int(v) for v in input().split())
print(max(a, b, c) - min(a, b, c))


corr = list(map(int, input().split()))
L = []
u = 0
for i in range(max(corr) + 1):
	L.append(abs(corr[0] - i) + abs(i - corr[2]) + abs(i - corr[1]))
print(min(L))


ls = sorted(list(map(int, input().split())))
print(ls[2] - ls[0])


c = list(map(int, input().split()))
c.sort()
mid = c[1]
print(mid - c[0] + c[2] - mid)


x = list(map(int, input().split()))
x.sort()
total_dist_max = 500
total_dist_min = 0
for i in range(min(x), max(x) + 1):
	for element in x:
		total_dist_min += abs(element - i)
	if total_dist_min < total_dist_max:
		total_dist_max = total_dist_min
	total_dist_min = 0
	if total_dist_min > total_dist_max:
		break
print(total_dist_max)


a = list(map(int, input().split()))
a.sort()
if len(a) % 2 != 0:
	s = a[int(len(a) / 2)]
	count = 0
	for x in a:
		count += abs(x - s)
	print(count)


living = list(map(int, input().split()))
living.sort()
dist = living[2] - living[0]
print(dist)


def main():
	try:
		while True:
			(a, b, c) = map(int, input().split())
			result = 300
			for i in range(1, 101):
				result = min(result, abs(a - i) + abs(b - i) + abs(c - i))
			print(result)
	except EOFError:
		pass
main()


s = [int(x) for x in input().split()]
print(max(s) - min(s))


points = input().split()
x = abs(int(points[0]) - int(points[1])) + abs(int(points[2]) - int(points[1]))
y = abs(int(points[0]) - int(points[2])) + abs(int(points[1]) - int(points[2]))
z = abs(int(points[1]) - int(points[0])) + abs(int(points[2]) - int(points[0]))
if x < y and x < z:
	print(str(x))
elif y < x and y < z:
	print(str(y))
elif z < y and z < x:
	print(str(z))


distances = sorted(list(map(int, input().split(' '))))
sum_d = 0
sum_d += distances[1] - distances[0]
sum_d += distances[2] - distances[1]
print(sum_d)


(x1, x2, x3) = map(int, input().split())
n = (x1 + x2 + x3) / 3
sum = 0
sum = abs(n - x1) + abs(n - x2) + abs(n - x3)
sum1 = abs(x2 - x1) + abs(x3 - x1)
sum = min(sum, sum1)
sum2 = abs(x1 - x2) + abs(x3 - x2)
sum = min(sum, sum2)
sum3 = abs(x1 - x3) + abs(x2 - x3)
sum = min(sum, sum3)
print(int(sum))


X = sorted(map(int, input().split()))
print(X[2] - X[0])


numeros = input(' ')
numeros = numeros.split(' ')
(a, b, c) = numeros
a = int(a)
b = int(b)
c = int(c)
numer = [a, b, c]
numer.sort()
(mini, med, maxi) = numer
menor = float('inf')
for itera in range(maxi - mini):
	suma = 0
	itera = itera + mini
	suma += abs(mini - itera)
	suma += abs(med - itera)
	suma += abs(maxi - itera)
	if suma <= menor:
		menor = suma
print(menor)


arr = list(map(int, input().split()))
arr.sort(reverse=True)
count = 0
count += arr[0] - arr[1]
count += arr[1] - arr[2]
print(count)


(a, b, c) = map(int, input().split())
s = []
s.append(a)
s.append(b)
s.append(c)
s = sorted(s)
p = s[2] - s[1] + s[1] - s[0]
print(p)


(x1, x2, x3) = map(int, input().split())
a = max(x1, x2, x3)
b = min(x1, x2, x3)
print(a - b)


inp = list(map(int, input().split()))
x1 = inp[0]
x2 = inp[1]
x3 = inp[2]
l = []
l.append(abs(x1 - x2) + abs(x1 - x3))
l.append(abs(x2 - x3) + abs(x1 - x3))
l.append(abs(x2 - x3) + abs(x1 - x2))
print(min(l))


l = list(map(int, input().split()))
for i in l:
	if i not in [min(l), max(l)]:
		pt = i
		break
ans = 0
for i in l:
	ans += abs(pt - i)
print(ans)


ox = list(map(int, input().split()))
ox.sort()
x1 = ox.pop(-3)
x2 = ox.pop(-2)
x3 = ox.pop()
print(x2 - x1 + (x3 - x2))


arr = list(map(int, input().split()))
ans = 0
arr.sort()
for i in range(0, len(arr)):
	ans += arr[1] - arr[0]
	ans += abs(arr[1] - arr[2])
print(int(ans / 3))


s = input().split(' ')
(a, b, c) = (int(s[0]), int(s[1]), int(s[2]))
(M, m) = (max(a, b, c), min(a, b, c))
d = 300
for i in range(m, M + 1):
	dist = abs(a - i) + abs(b - i) + abs(c - i)
	if dist < d:
		d = dist
print(d)


a = [int(e) for e in input().split()]
a.sort()
print(a[2] - a[0])


a = list(map(int, input().split()))
a = sorted(a)
x = a[-1] - a[0]
print(x)


list1 = sorted(map(int, input().split()))
print(list1[-1] - list1[0])


(a, b, c) = [int(x) for x in input().split()]
answer = 1000
for i in range(1, 101):
	temp = abs(a - i) + abs(b - i) + abs(c - i)
	answer = min(answer, temp)
print(answer)


import sys

def c():
	_input = sys.stdin.readlines()
	arr = _input[0].strip().split(' ')
	arr = [int(a) for a in arr]
	print(max(arr) - min(arr))
c()


from typing import Callable, Iterator, List, TypeVar, cast
_F = TypeVar('_F', bound=Callable[[], None])

def repeater(func: _F) -> _F:

	def wrapper():
		for _ in range(int(input())):
			func()
	return cast(_F, wrapper)

def get_num_input() -> Iterator[int]:
	return map(int, input().split())

def main() -> None:
	one: int
	two: int
	(one, _, two) = sorted(get_num_input())
	print(two - one)
main()


f1f2f3 = list(map(int, input().split()))
f = sorted(f1f2f3)
f1 = int(f[0])
f2 = int(f[1])
f3 = int(f[2])
print(f2 - f1 + (f3 - f2))


(a, b, c) = [int(x) for x in input().split()]
k = max(a, b, c)
if k == a:
	d = max(b, c)
elif k == b:
	d = max(a, c)
else:
	d = max(a, b)
s = abs(a - d) + abs(b - d) + abs(c - d)
print(s)


x = list(map(int, input().split()))
k = 10000000000
for i in range(min(x), max(x) + 1):
	k = min(k, abs(x[0] - i) + abs(x[1] - i) + abs(x[2] - i))
print(k)


l = list(map(int, input().split()))
l.sort()
m = l[1]
ans = 0
for i in l:
	ans += abs(m - i)
print(ans)


s = input()
s = s.split()
p = []
for i in s:
	p.append(int(i))
p.sort()
ans = int(p[2]) - int(p[0])
print(ans)


(x1, x2, x3) = map(int, input().split())
minimum = 100000000000000

def distance(p, x1, x2, x3):
	total = abs(x1 - p) + abs(x2 - p) + abs(x3 - p)
	return total
for i in range(100):
	t = distance(i + 1, x1, x2, x3)
	minimum = min(minimum, t)
print(minimum)


import math
(a1, a2, a3) = map(int, input().split())
a = abs(a1 - a2)
b = abs(a1 - a3)
c = abs(a2 - a3)
s = a + b
min = s
if a + c < min:
	min = a + c
if b + c < min:
	min = b + c
print(min)


def r(a, b):
	c = a - b
	return abs(c)
(a, b, c) = map(int, input().split())
ans = 200
for i in range(max(a, b, c)):
	ans = min(ans, r(c, i) + r(b, i) + r(a, i))
print(ans)


l = list(map(int, input().split()))
l = sorted(l)
x = l[1]
c = x - l[0] + (l[2] - x)
print(c)


x = sorted([int(s) for s in input().split()])
print(x[2] - x[0])


nums = list(map(int, input().split()))
nums.sort()
print(nums[2] - nums[1] + (nums[1] - nums[0]))


def main():
	(a, b, c) = list(map(int, input().split()))
	x = max(a, b, c) + 1
	if a != max(a, b, c):
		x = a
	if b != max(a, b, c):
		x = b
	if c != max(a, b, c):
		x = c
	print(x - min(a, b, c) + (max(a, b, c) - x))
main()


lst = [int(x) for x in input().split()]
lst.sort()
print(lst[2] - lst[1] + (lst[1] - lst[0]))


xs = list(map(int, input().split()))
xs.sort(reverse=True)
miles = 0
miles += xs[0] - xs[1] + (xs[1] - xs[2])
print(miles)


inputs = input()
inputs = list(map(int, inputs.split(' ')))
min_position = min(inputs)
max_position = max(inputs)

def total_distance(p):
	sum = 0
	for i in inputs:
		sum += abs(i - p)
	return sum
min_sum = (0, float('inf'))
for i in range(min_position - 1, max_position + 1):
	t_d = total_distance(i)
	if t_d < min_sum[1]:
		min_sum = (i, t_d)
print(min_sum[1])


(x1, x2, x3) = map(int, input().split())
x = []
x.append(x1)
x.append(x2)
x.append(x3)
i = 1
while i < len(x):
	key = x[i]
	j = i - 1
	while j >= 0 and x[j] > key:
		x[j + 1] = x[j]
		j = j - 1
	x[j + 1] = key
	i = i + 1
l = int(x[2]) - int(x[1])
k = int(x[1]) - int(x[0])
print(l + k)


N = list(map(int, input().split()))
print(max(N) - (min(N) + max(N)) // 2 + (min(N) + max(N)) // 2 - min(N))


s = input()
f = list(map(int, s.split()))
f.sort()
print(f[1] - f[0] + (f[2] - f[1]))


temp = list(map(int, input().split()))
temp.sort()
a = temp[0]
b = temp[1]
c = temp[2]
print(abs(a - b) + abs(c - b))


(a, b, c) = map(int, input().split())
f = [a, b, c]
f.sort()
g = f[1] - f[0] + (f[2] - f[1])
print(g)