function calc(input) {
  var array = input.split(' ');
  var A = parseInt(array[0]);
  var B = parseInt(array[1]);
  var C = parseInt(array[2]);

  var ascArray = [A, B, C].sort(function(a, b) {
    return a - b;
  });

  var min = ascArray[0];
  var mid = ascArray[1];
  var max = ascArray[2];

  var diffFromMidToMax = max - mid;
  var diffFromMinToMid = mid - min;
  var isMod0 = diffFromMinToMid % 2 === 0;

  if(min === mid === max){
    return 0;
  }

  if (mid === min) {
    return max - min;
  }

  if (mid === max) {
    return Math.floor(diffFromMinToMid / 2) + (isMod0 ? 0 : 2);
  }

  return diffFromMidToMax + Math.floor(diffFromMinToMid / 2) + (isMod0 ? 0 : 2);
}

function main(input) {
  console.log(calc(input));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
