import Foundation
// Decimal型の有効桁数は38桁
let line = readLine()!.components(separatedBy: " ").map { Decimal(string: $0)! }

for i in 0..<5 {
    if line[i] == 0 {
        print(i + 1)
        exit(EXIT_SUCCESS)
    }
}
