l=list(map(int,input().split()))



if l.count(l[0])==3:

    if l[0]%2==0:

        print((-1))

        exit()

    else:

        print((0))

        exit()



count=0

while True:

    temp=list([x%2 for x in l])

    all=sum(temp)

    if all==3:

        print((count+1))

        exit()

    elif all==2:

        print(count)

        exit()

    elif all==1:

        print(count)

        exit()

    l=list([x//2 for x in l])

    count+=1



l=list(map(int,input().split()))



for i in range(3):

    if l[i]%2==1:

        print((0))

        exit()



if l.count(l[0])==3:

    if l[0]%2==0:

        print((-1))

        exit()

    else:

        print((0))

        exit()



count=0

while True:

    temp=list([x%2 for x in l])

    all=sum(temp)

    if all==3:

        print((count+1))

        exit()

    elif all==2:

        print(count)

        exit()

    elif all==1:

        print(count)

        exit()

    l=list([x//2 for x in l])

    count+=1



l = list(map(int, input().split()))
if l.count(l[0]) == 3:
    if l[0] % 2 == 0:
        print((-1))
        exit()
    else:
        print((0))
        exit()
count = 0
while True:
    temp = list([x % 2 for x in l])
    all = sum(temp)
    if all == 3:
        print((count + 1))
        exit()
    elif all == 2:
        print(count)
        exit()
    elif all == 1:
        print(count)
        exit()
    l = list([x // 2 for x in l])
    count += 1

l = list(map(int, input().split()))
for i in range(3):
    if l[i] % 2 == 1:
        print((0))
        exit()
if l.count(l[0]) == 3:
    if l[0] % 2 == 0:
        print((-1))
        exit()
    else:
        print((0))
        exit()
count = 0
while True:
    temp = list([x % 2 for x in l])
    all = sum(temp)
    if all == 3:
        print((count + 1))
        exit()
    elif all == 2:
        print(count)
        exit()
    elif all == 1:
        print(count)
        exit()
    l = list([x // 2 for x in l])
    count += 1

+for i in range(3): +    if l[i] % 2 == 1: +        print((0)) +        exit()