You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order:    * Choose two among A, B and C, then increase both by 1.   * Choose one among A, B and C, then increase it by 2.  It can be proved that we can always make A, B and C all equal by repeatedly performing these operations.

def main()->None:
    L = list(map(int, input().split()))
    print(L)
    L.sort()
    print(L)
    count = 0
    
    if L[2] % 2 == 0:
        L[0] += 1
        L[2] += 1
        count += 1
        flag = True
        while flag:
            L[0]+=1
            L[1]+=1
            count += 1
            if L[1] == L[2]:
                flag = False
       
    
    else:
        flag = True
        while flag:
            L[0] += 1
            L[1] += 1
            count += 1
            if L[1] == L[2]:
                flag = False
        flag = True
        while flag:
            L[0] += 2
            count += 1
            if L[0] == L[2]:
                flag = False
    print(count)




if __name__ == "__main__":
    main()

def main()->None:
    
    
    l = list(map(int, input().split()))
    l.sort()
    
    l[0] = l[2] - l[0]
    l[1] = l[2] - l[1]
    l[2] = 0
    
    
    count = 0
    while True:
        if l[1] - 2 < 0:
            if l[1] == 0:
                break
            else:
                l[1] -= 1
                l[0] -= 1
                count += 1
                break
        l[1] -= 2
        count += 1

    
    while True:
        if l[0] <= 0:
            if l[0] == 0:
                flag = True
                break
            if l[0] < 0:
                count += 1
                break
        l[0] -= 2
        count += 1
    print(count)


if __name__ == "__main__":
    main()