def middle(lst):

    _lst = lst

    _lst.sort()

    return _lst[-2]



def min_times(lst):

    data = lst

    times = 0

    idx_even = []

    idx_odd = []

    for i, v in enumerate(data):

        if v % 2 == 0:

            idx_even.append(i)

        else:

            idx_odd.append(i)

    odd_len = len(idx_odd)

    if odd_len in (0, 3):

        times += (max(data) - middle(data)) / 2

        times += (max(data) - min(data)) / 2

    if odd_len == 2:

        for i in idx_odd:

            data[i] += 1

        return min_times(data) + 1

    if odd_len == 1:

        for i in idx_even:

            data[i] += 1

        return min_times(data) + 1

    return times



use_data = [int(i) for i in input().split()]



print((min_times(use_data)))
def middle(lst):

    _lst = lst

    _lst.sort()

    return _lst[-2]



def min_times(lst):

    data = lst

    times = 0

    idx_even = []

    idx_odd = []

    for i, v in enumerate(data):

        if v % 2 == 0:

            idx_even.append(i)

        else:

            idx_odd.append(i)

    odd_len = len(idx_odd)

    if odd_len in (0, 3):

        times += (max(data) - middle(data)) / 2

        times += (max(data) - min(data)) / 2

    if odd_len == 2:

        for i in idx_odd:

            data[i] += 1

        return min_times(data) + 1

    if odd_len == 1:

        for i in idx_even:

            data[i] += 1

        return min_times(data) + 1

    return times



use_data = [int(i) for i in input().strip().split()]



print((min_times(use_data)))
def middle(lst):
    _lst = lst
    _lst.sort()
    return _lst[-2]


def min_times(lst):
    data = lst
    times = 0
    idx_even = []
    idx_odd = []
    for i, v in enumerate(data):
        if v % 2 == 0:
            idx_even.append(i)
        else:
            idx_odd.append(i)
    odd_len = len(idx_odd)
    if odd_len in (0, 3):
        times += (max(data) - middle(data)) / 2
        times += (max(data) - min(data)) / 2
    if odd_len == 2:
        for i in idx_odd:
            data[i] += 1
        return min_times(data) + 1
    if odd_len == 1:
        for i in idx_even:
            data[i] += 1
        return min_times(data) + 1
    return times


use_data = [int(i) for i in input().split()]
print((min_times(use_data)))

def middle(lst):
    _lst = lst
    _lst.sort()
    return _lst[-2]


def min_times(lst):
    data = lst
    times = 0
    idx_even = []
    idx_odd = []
    for i, v in enumerate(data):
        if v % 2 == 0:
            idx_even.append(i)
        else:
            idx_odd.append(i)
    odd_len = len(idx_odd)
    if odd_len in (0, 3):
        times += (max(data) - middle(data)) / 2
        times += (max(data) - min(data)) / 2
    if odd_len == 2:
        for i in idx_odd:
            data[i] += 1
        return min_times(data) + 1
    if odd_len == 1:
        for i in idx_even:
            data[i] += 1
        return min_times(data) + 1
    return times


use_data = [int(i) for i in input().strip().split()]
print((min_times(use_data)))

-use_data = [int(i) for i in input().split()] +use_data = [int(i) for i in input().strip().split()]