import Foundation
func toTuple<T>(_ args: [T]) -> (T, T) { (args[0], args[1]) }
func toTuple<T>(_ args: [T]) -> (T, T, T) { (args[0], args[1], args[2]) }
func toTuple<T>(_ args: [T]) -> (T, T, T, T) { (args[0], args[1], args[2], args[3]) }
func readInts() -> [Int] { readLine()!.split(separator: " ").map { Int($0)! } }
func readDoubles() -> [Double] { readLine()!.split(separator: " ").map { Double($0)! } }
func readStrings() -> [String] { readLine()!.split(separator: " ").map { String($0) } }

let xi = readInts()
var ans = 0
for (i, x) in xi.enumerated() {
  ans = i + 1
  if (x == 0) { break }
}
print(ans)