import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.numeric;


void main()
{
  auto abc = new int[](3);
  readf("%s %s %s\n", &abc[0], &abc[1], &abc[2]);

  auto eo = new int[](3);
  foreach (i; 0..3) {
    eo[i] = abc[i] % 2;
  }
  int num;
  if (eo.sum % 3 != 0) {
    if (eo[0] == eo[1]) {
      abc[0]++;
      abc[1]++;
    } else if (eo[0] == eo[2]) {
      abc[0]++;
      abc[2]++;
    } else {
      abc[1]++;
      abc[2]++;
    }
    num++;
  }

  auto m = max(abc[0], max(abc[1], abc[2]));
  foreach (i; 0..3) {
    while (abc[i] != m) {
      abc[i] += 2;
      num++;
    }
  }
  num.writeln;
}
