import std.stdio,
       std.string,
       std.conv,
       std.algorithm;

int solve(int[] a) {
  sort(a);

  int count = 0;
  count += (a[1] - a[0]) / 2;
  a[0] += (a[1] - a[0]) / 2 * 2;
  a[0] += a[2] - a[1];
  count += a[2] - a[1];
  a[1] += a[2] - a[1];

  if (a[0] == a[1] && a[1] == a[2]) {
    return count;
  }
  else {
    return count + 2;
  }
}

void main() {
  int[] a = readln.chomp.split.to!(int[]);

  writeln(solve(a));
}
