import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{

	public static int min(int[] a)
	{
		int min = a[0];
		for (int i = 0; i < a.length; i++) {
			if(a[i]<min && a [i]!=-1)
			{	min=a[i];
				a[i]=-1;
				System.out.println(a[i]);
			}	
		}
		return min;	
	}
	
	
	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		int x,y,z;
		
		String s = reader.readLine();
		String[] inp = s.split(" ");
		
		x=Integer.parseInt(inp[0]);
		y=Integer.parseInt(inp[1]);
		z=Integer.parseInt(inp[2]);
		
		int[] arr = new int[3];
		arr[0]=x;arr[1]=y;arr[2]=z;
		
		int cost=0;
		
		int a  = Math.min(x,Math.min(y,z));
				
		if(a==x)
		{
			int b = Math.max(y,z);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(y,z)-b);
			
		}
		else if(a==y)
		{
			int b = Math.max(x,z);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(x,z)-b);
			
		}
		else if(a==z)
		{
			int b = Math.max(x,y);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(x,y)-b);
		}

		System.out.println(cost);
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io class Main{

	public static int min(int[] a)
	{
		int min = a[0];
		for (int i = 0; i < a.length; i++) {
			if(a[i]<min && a [i]!=-1)
			{	min=a[i];
				a[i]=-1;
				System.out.println(a[i]);
			}	
		}
		return min;	
	}
	
	
	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		int x,y,z;
		
		String s = reader.readLine();
		String[] inp = s.split(" ");
		
		x=Integer.parseInt(inp[0]);
		y=Integer.parseInt(inp[1]);
		z=Integer.parseInt(inp[2]);
		
		int[] arr = new int[3];
		arr[0]=x;arr[1]=y;arr[2]=z;
		
		int cost=0;
		
		int a  = Math.min(x,Math.min(y,z));
				
		if(a==x)
		{
			int b = Math.max(y,z);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(y,z)-b);
			
		}
		else if(a==y)
		{
			int b = Math.max(x,z);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(x,z)-b);
			
		}
		else if(a==z)
		{
			int b = Math.max(x,y);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(x,y)-b);
		}

		System.out.println(cost);
	}

} Main public static int min(int[] a)
	{
		int min = a[0];
		for (int i = 0; i < a.length; i++) {
			if(a[i]<min && a [i]!=-1)
			{	min=a[i];
				a[i]=-1;
				System.out.println(a[i]);
			}	
		}
		return min;	
	} min {
		int min = a[0];
		for (int i = 0; i < a.length; i++) {
			if(a[i]<min && a [i]!=-1)
			{	min=a[i];
				a[i]=-1;
				System.out.println(a[i]);
			}	
		}
		return min;	
	} int min = a[0]; min a[0] a 0 for (int i = 0; i < a.length; i++) {
			if(a[i]<min && a [i]!=-1)
			{	min=a[i];
				a[i]=-1;
				System.out.println(a[i]);
			}	
		} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
			if(a[i]<min && a [i]!=-1)
			{	min=a[i];
				a[i]=-1;
				System.out.println(a[i]);
			}	
		} {
			if(a[i]<min && a [i]!=-1)
			{	min=a[i];
				a[i]=-1;
				System.out.println(a[i]);
			}	
		} if(a[i]<min && a [i]!=-1)
			{	min=a[i];
				a[i]=-1;
				System.out.println(a[i]);
			} a[i]<min && a [i]!=-1 a[i]<min a[i] a i min a [i]!=-1 a [i] a i -1 1 {	min=a[i];
				a[i]=-1;
				System.out.println(a[i]);
			} min=a[i] min a[i] a i a[i]=-1 a[i] a i -1 1 System.out.println(a[i]) System.out.println System.out System System.out a[i] a i return min; min int[] a a public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		int x,y,z;
		
		String s = reader.readLine();
		String[] inp = s.split(" ");
		
		x=Integer.parseInt(inp[0]);
		y=Integer.parseInt(inp[1]);
		z=Integer.parseInt(inp[2]);
		
		int[] arr = new int[3];
		arr[0]=x;arr[1]=y;arr[2]=z;
		
		int cost=0;
		
		int a  = Math.min(x,Math.min(y,z));
				
		if(a==x)
		{
			int b = Math.max(y,z);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(y,z)-b);
			
		}
		else if(a==y)
		{
			int b = Math.max(x,z);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(x,z)-b);
			
		}
		else if(a==z)
		{
			int b = Math.max(x,y);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(x,y)-b);
		}

		System.out.println(cost);
	} main {
		// TODO Auto-generated method stub
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		int x,y,z;
		
		String s = reader.readLine();
		String[] inp = s.split(" ");
		
		x=Integer.parseInt(inp[0]);
		y=Integer.parseInt(inp[1]);
		z=Integer.parseInt(inp[2]);
		
		int[] arr = new int[3];
		arr[0]=x;arr[1]=y;arr[2]=z;
		
		int cost=0;
		
		int a  = Math.min(x,Math.min(y,z));
				
		if(a==x)
		{
			int b = Math.max(y,z);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(y,z)-b);
			
		}
		else if(a==y)
		{
			int b = Math.max(x,z);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(x,z)-b);
			
		}
		else if(a==z)
		{
			int b = Math.max(x,y);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(x,y)-b);
		}

		System.out.println(cost);
	} BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) int x x y y z; z String s = reader.readLine(); s reader.readLine() reader.readLine reader String[] inp = s.split(" "); inp s.split(" ") s.split s " " x=Integer.parseInt(inp[0]) x Integer.parseInt(inp[0]) Integer.parseInt Integer inp[0] inp 0 y=Integer.parseInt(inp[1]) y Integer.parseInt(inp[1]) Integer.parseInt Integer inp[1] inp 1 z=Integer.parseInt(inp[2]) z Integer.parseInt(inp[2]) Integer.parseInt Integer inp[2] inp 2 int[] arr = new int[3]; arr new int[3] 3 arr[0]=x arr[0] arr 0 x arr[1]=y arr[1] arr 1 y arr[2]=z arr[2] arr 2 z int cost=0; cost 0 int a  = Math.min(x,Math.min(y,z)); a Math.min(x,Math.min(y,z)) Math.min Math x Math.min(y,z) Math.min Math y z if(a==x)
		{
			int b = Math.max(y,z);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(y,z)-b);
			
		}
		else if(a==y)
		{
			int b = Math.max(x,z);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(x,z)-b);
			
		}
		else if(a==z)
		{
			int b = Math.max(x,y);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(x,y)-b);
		} a==x a x {
			int b = Math.max(y,z);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(y,z)-b);
			
		} int b = Math.max(y,z); b Math.max(y,z) Math.max Math y z cost=cost+Math.abs(b-a) cost cost+Math.abs(b-a) cost Math.abs(b-a) Math.abs Math b-a b a cost=cost+(Math.max(y,z)-b) cost cost+(Math.max(y,z)-b) cost (Math.max(y,z)-b) Math.max(y,z) Math.max Math y z b if(a==y)
		{
			int b = Math.max(x,z);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(x,z)-b);
			
		}
		else if(a==z)
		{
			int b = Math.max(x,y);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(x,y)-b);
		} a==y a y {
			int b = Math.max(x,z);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(x,z)-b);
			
		} int b = Math.max(x,z); b Math.max(x,z) Math.max Math x z cost=cost+Math.abs(b-a) cost cost+Math.abs(b-a) cost Math.abs(b-a) Math.abs Math b-a b a cost=cost+(Math.max(x,z)-b) cost cost+(Math.max(x,z)-b) cost (Math.max(x,z)-b) Math.max(x,z) Math.max Math x z b if(a==z)
		{
			int b = Math.max(x,y);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(x,y)-b);
		} a==z a z {
			int b = Math.max(x,y);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(x,y)-b);
		} int b = Math.max(x,y); b Math.max(x,y) Math.max Math x y cost=cost+Math.abs(b-a) cost cost+Math.abs(b-a) cost Math.abs(b-a) Math.abs Math b-a b a cost=cost+(Math.max(x,y)-b) cost cost+(Math.max(x,y)-b) cost (Math.max(x,y)-b) Math.max(x,y) Math.max Math x y b System.out.println(cost) System.out.println System.out System System.out cost String[] args args
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{

	public static int min(int[] a)
	{
		int min = a[0];
		for (int i = 0; i < a.length; i++) {
			if(a[i]<min && a [i]!=-1)
			{	min=a[i];
				a[i]=-1;
				System.out.println(a[i]);
			}	
		}
		return min;	
	}
	
	
	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		int x,y,z;
		
		String s = reader.readLine();
		String[] inp = s.split(" ");
		
		x=Integer.parseInt(inp[0]);
		y=Integer.parseInt(inp[1]);
		z=Integer.parseInt(inp[2]);
		
		int[] arr = new int[3];
		arr[0]=x;arr[1]=y;arr[2]=z;
		
		int cost=0;
		
		int a  = Math.min(x,Math.min(y,z));
				
		if(a==x)
		{
			int b = Math.max(y,z);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(y,z)-b);
			
		}
		else if(a==y)
		{
			int b = Math.max(x,z);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(x,z)-b);
			
		}
		else if(a==z)
		{
			int b = Math.max(x,y);
			cost=cost+Math.abs(b-a);
			
			cost=cost+(Math.max(x,y)-b);
		}

		System.out.println(cost);
	}

}
