object Main extends App {
	var Array(a, b, c) = scala.io.StdIn.readLine.split(" ").map(_.toInt).sorted

	def  test(a: Int, b: Int, c: Int) = a==b && b==c

	var ans = 0

	while(! test(a,b,c)){
		if(a==b){
			val t = c-a
			ans += t
			a = 1
			b = 1
			c = 1
		}else if(b==c){
			val t = (b-a)/2
			(b-a)%2 match {
				case 0 => {
					ans += t
					a = b
				}
				case 1 => {
					ans += t + 2
					a = 1
					b = 1
					c = 1
				}
			}
		}else{
			val t = c-b
			ans += t
			b += t
			a += t
		}
	} 

	println(ans)
}