import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);

void main()
{
    long a, b, c;
    scan(a, b, c);
    long max_x = max(a, b, c);
    long sum_x = a + b + c;
    long x, y;
    if (((max_x % 2 == 0) && (sum_x % 2 == 0)) || (max_x % 2 != 0) && (sum_x % 2 != 0))
    {
        x = (max_x * 3 - sum_x) / 2;
        writeln(x);
        return;
    }
    y = ((max_x * 3 + 3) - sum_x) / 2;
    writeln(y);
}
//https://rclone.org/

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}
