fun main(args: Array<String>) {
    data class Cookies(val a: Long, val b: Long, val c: Long) {
        fun invalid(): Boolean {
            return a % 2 == 1L || b % 2 == 1L || c % 2 == 1L
        }
    }

    var cookies = readLine()?.split(" ")?.map(String::toLong)?.let { Cookies(it[0], it[1], it[2]) } ?: return
    val history = hashMapOf<Cookies, Boolean>()
    if (cookies.invalid()) {
        println("0")
        return
    }
    var i = 1
    while (true) {
        val a = cookies.b / 2 + cookies.c / 2
        val b = cookies.a / 2 + cookies.c / 2
        val c = cookies.a / 2 + cookies.b / 2
        cookies = Cookies(a, b, c)
        if (history.containsKey(cookies)) {
            println("-1")
            return
        }
        if (cookies.invalid()) {
            println((i).toString())
            return
        }
        history[cookies] = true
        i++
    }
}
