Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim a As Integer = NextInt()
        Dim b As Integer = NextInt()
        Dim c As Integer = NextInt()
        Dim ans As Integer
        Dim dic As New List(Of Integer())
        Dim flg As Boolean

        Do
            Dim abc As Integer() = New Integer() {a, b, c}
            Array.Sort(abc)
            If Contains(dic, abc) Then ans = -1
            For Each v As Integer In abc
                If v Mod 2 <> 0 Then flg = True
            Next
            If flg OrElse ans < 0 Then Exit Do
            ans += 1
            dic.Add(abc)
            Dim x As Integer = b \ 2 + c \ 2
            Dim y As Integer = c \ 2 + a \ 2
            Dim z As Integer = a \ 2 + b \ 2
            a = x
            b = y
            c = z
        Loop
        WriteLine(ans)
    End Sub

    Function Contains(dic As IList(Of Integer()), abc As Integer()) As Boolean
        For Each dic_i As Integer() In dic
            Dim flg As Boolean = False
            Dim j As Integer = 0
            For Each dic_ij As Integer In dic_i
                If dic_ij <> abc(j) Then
                    flg = True
                End If
                j += 1
            Next
            If Not flg Then Return True
        Next
        Return False
    End Function

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function
End Module
