function Main(input){
	input=input.split(/\n|\s/);
	input.pop();
	input.forEach(function(e,i,a){a[i]=Number(a[i]);});
	function ArraySortNumeric(prev,next){return prev-next;}
	var a=0;
	input.sort(ArraySortNumeric);
	
	while(input[0]+2<=input[2]){input[0]+=2;a++;}
	while(input[1]+2<=input[2]){input[1]+=2;a++;}
	input.sort(ArraySortNumeric);
	if(input[0]==input[2]){}
	else if(input[0]==input[1]){a++;}
	else{a+=2;}
	
	console.log(a);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));