function Main(s) {
  s = s.split(" ").map(a => +a);
  var a = s[0];
  var b = s[1];
  var c = s[2];
  var ans = 0;
  while(a !== b || a !== c){
    var d = Math.min(a, b, c);
    if(a === d){
      if(a === b){a++;b++;}
      else if(a === c){a++;c++;}
      else a += 2;
    }else if(b === d){
      if(b === c){b++;c++;}
      else b += 2;
    }else c += 2;
    ans++;
  }
	console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));