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

void main() {
    auto tmp = readln.split.to!(int[]).sort().array;
    int cnt = 0;
    while (tmp[0] != tmp[2]) {
        if (tmp[2] - tmp[0] >= 2) tmp[0] += 2;
        else {
            ++tmp[0..2];
        }
        cnt++;
        tmp = tmp.sort().array;
    }
    writeln(cnt);
}
