"use strict"
function Main(input) {
  input = input.trim().split(' ').map(Number);
  const A = input[0];
  const B = input[1];
  const C = input[2];
  let sum = A + B + C;
  let max = Math.max(A, B, C);
  let M = 3 * max;

  let ret = 0;
  if(M%2 === sum%2){
    ret = (M-sum)/2;
  } else {
    ret = (M+3-sum)/2;
  }

  console.log(ret);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));