void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  auto a=readln.split.to!(int[]);

  sort(a);
  int cnt=0;
  while(a[0]+2<=a[2]) a[0]+=2, cnt++;
  while(a[1]+2<=a[2]) a[1]+=2, cnt++;
  sort(a);
  assert(a[2]-a[0]<=1);

  int ad=0;
  if(a[0]==a[1] && a[1]==a[2]) ad=0;
  else if(a[0]==a[1]) ad=1;
  else if(a[1]==a[2]) ad=2;

  writeln(cnt+ad);
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x) e=l[i].to!(typeof(e));
}
