# 1. 3つとも違う数字

#  => 小さいふたつを + 1

# 2. 2つ同じ数字

#  => 1つだけの数字が小さい

#     小さい数字を + 2

#  => 1つだけの数字が大きい

#     小さいふたつを + 1

a, b, c = list(map(int, input().split()))

result = 0

while True:

  if a == b and b == c:

    break

  elif a != b and b != c and a != c:

    if a < b:

      if b < c:

        a += 1

        b += 1

      else:

        a += 1

        c += 1

    else:

      if a < c:

        a += 1

        b += 1

      else:

        b += 1

        c += 1

  else:

    if a == b:

      if a > c:

        c += 2

      else:

        a += 1

        b += 1

    elif b == c:

      if a > b:

        b += 1

        c += 1

      else:

        a += 2

    else:

      # a == c

      if a > b:

        b += 2

      else:

        a += 1

        c += 1

  result += 1

print(result)

A, B, C = list(map(int, input().split()))



# 1. 3つとも違う数字

#  => 小さいふたつを + 1

# 2. 2つ同じ数字

#  => 1つだけの数字が小さい

#     小さい数字を + 2

#  => 1つだけの数字が大きい

#     小さいふたつを + 1

result = 0

while True:

    if A == B and B == C:

        break

    elif A != B and B != C and A != C:

        if A < B:

            if B < C:

                A += 1

                B += 1

            else:

                A += 1

                C += 1

        else:

            if A < C:

                A += 1

                B += 1

            else:

                B += 1

                C += 1

    else:

        if A == B:

            if A > C:

                C += 2

            else:

                A += 1

                B += 1

        elif B == C:

            if A > B:

                B += 1

                C += 1

            else:

                A += 2

        else:

            # A == C

            if A > B:

                B += 2

            else:

                A += 1

                C += 1

    result += 1

print(result)

# 1. 3つとも違う数字
#  => 小さいふたつを + 1
# 2. 2つ同じ数字
#  => 1つだけの数字が小さい
#     小さい数字を + 2
#  => 1つだけの数字が大きい
#     小さいふたつを + 1
a, b, c = list(map(int, input().split()))
result = 0
while True:
    if a == b and b == c:
        break
    elif a != b and b != c and a != c:
        if a < b:
            if b < c:
                a += 1
                b += 1
            else:
                a += 1
                c += 1
        else:
            if a < c:
                a += 1
                b += 1
            else:
                b += 1
                c += 1
    else:
        if a == b:
            if a > c:
                c += 2
            else:
                a += 1
                b += 1
        elif b == c:
            if a > b:
                b += 1
                c += 1
            else:
                a += 2
        else:
            # a == c
            if a > b:
                b += 2
            else:
                a += 1
                c += 1
    result += 1
print(result)

A, B, C = list(map(int, input().split()))
# 1. 3つとも違う数字
#  => 小さいふたつを + 1
# 2. 2つ同じ数字
#  => 1つだけの数字が小さい
#     小さい数字を + 2
#  => 1つだけの数字が大きい
#     小さいふたつを + 1
result = 0
while True:
    if A == B and B == C:
        break
    elif A != B and B != C and A != C:
        if A < B:
            if B < C:
                A += 1
                B += 1
            else:
                A += 1
                C += 1
        else:
            if A < C:
                A += 1
                B += 1
            else:
                B += 1
                C += 1
    else:
        if A == B:
            if A > C:
                C += 2
            else:
                A += 1
                B += 1
        elif B == C:
            if A > B:
                B += 1
                C += 1
            else:
                A += 2
        else:
            # A == C
            if A > B:
                B += 2
            else:
                A += 1
                C += 1
    result += 1
print(result)

+A, B, C = list(map(int, input().split())) -a, b, c = list(map(int, input().split())) -    if a == b and b == c: +    if A == B and B == C: -    elif a != b and b != c and a != c: -        if a < b: -            if b < c: -                a += 1 -                b += 1 +    elif A != B and B != C and A != C: +        if A < B: +            if B < C: +                A += 1 +                B += 1 -                a += 1 -                c += 1 +                A += 1 +                C += 1 -            if a < c: -                a += 1 -                b += 1 +            if A < C: +                A += 1 +                B += 1 -                b += 1 -                c += 1 +                B += 1 +                C += 1 -        if a == b: -            if a > c: -                c += 2 +        if A == B: +            if A > C: +                C += 2 -                a += 1 -                b += 1 -        elif b == c: -            if a > b: -                b += 1 -                c += 1 +                A += 1 +                B += 1 +        elif B == C: +            if A > B: +                B += 1 +                C += 1 -                a += 2 +                A += 2 -            # a == c -            if a > b: -                b += 2 +            # A == C +            if A > B: +                B += 2 -                a += 1 -                c += 1 +                A += 1 +                C += 1