def slove():

    import sys

    import bisect

    import collections

    import fractions

    import heapq

    input = sys.stdin.readline

    a, b, c = list(map(int, input().rstrip('\n').split()))

    cnt = 0

    while True:

        a, b, c = sorted([a, b, c])

        if abs(a - c) >= 2:

            a += 2

            cnt += 1

        else:

            if a == b == c:

                print(cnt)

                exit()

            if a == b:

                a += 1

                b += 1

                cnt += 1

            elif b == c:

                b += 1

                c += 1

                cnt += 1

            elif a == c:

                a += 1

                c += 1

                cnt += 1





if __name__ == '__main__':

    slove()

import sys





def solve():

    readline = sys.stdin.buffer.readline

    mod = 10 ** 9 + 7

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

    sn = sum([a, b, c])

    mn = max(a, b, c)

    for i in range(mn * 3, 10 ** 10, 3):

        if (i - sn) % 2 == 0:

            print(((i - sn) // 2))

            exit()





if __name__ == '__main__':

    solve()

def slove():
    import sys
    import bisect
    import collections
    import fractions
    import heapq

    input = sys.stdin.readline
    a, b, c = list(map(int, input().rstrip("\n").split()))
    cnt = 0
    while True:
        a, b, c = sorted([a, b, c])
        if abs(a - c) >= 2:
            a += 2
            cnt += 1
        else:
            if a == b == c:
                print(cnt)
                exit()
            if a == b:
                a += 1
                b += 1
                cnt += 1
            elif b == c:
                b += 1
                c += 1
                cnt += 1
            elif a == c:
                a += 1
                c += 1
                cnt += 1


if __name__ == "__main__":
    slove()

import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10**9 + 7
    a, b, c = list(map(int, readline().split()))
    sn = sum([a, b, c])
    mn = max(a, b, c)
    for i in range(mn * 3, 10**10, 3):
        if (i - sn) % 2 == 0:
            print(((i - sn) // 2))
            exit()


if __name__ == "__main__":
    solve()

-def slove(): -    import sys -    import bisect -    import collections -    import fractions -    import heapq +import sys -    input = sys.stdin.readline -    a, b, c = list(map(int, input().rstrip("\n").split())) -    cnt = 0 -    while True: -        a, b, c = sorted([a, b, c]) -        if abs(a - c) >= 2: -            a += 2 -            cnt += 1 -        else: -            if a == b == c: -                print(cnt) -                exit() -            if a == b: -                a += 1 -                b += 1 -                cnt += 1 -            elif b == c: -                b += 1 -                c += 1 -                cnt += 1 -            elif a == c: -                a += 1 -                c += 1 -                cnt += 1 + +def solve(): +    readline = sys.stdin.buffer.readline +    mod = 10**9 + 7 +    a, b, c = list(map(int, readline().split())) +    sn = sum([a, b, c]) +    mn = max(a, b, c) +    for i in range(mn * 3, 10**10, 3): +        if (i - sn) % 2 == 0: +            print(((i - sn) // 2)) +            exit() -    slove() +    solve()